fix: update the filter removing existing users from Jellyfin import modal (#924)
Currently import button sometimes shows already imported users and this would break it if an admin tries to import an already imported user.
This commit is contained in:
@@ -56,14 +56,6 @@ const JellyfinImportModal: React.FC<JellyfinImportProps> = ({
|
|||||||
`/api/v1/user?take=${children}`
|
`/api/v1/user?take=${children}`
|
||||||
);
|
);
|
||||||
|
|
||||||
data?.forEach((user, pos) => {
|
|
||||||
if (
|
|
||||||
existingUsers?.results.some((data) => data.jellyfinUserId === user.id)
|
|
||||||
) {
|
|
||||||
data?.splice(pos, 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const importUsers = async () => {
|
const importUsers = async () => {
|
||||||
setImporting(true);
|
setImporting(true);
|
||||||
|
|
||||||
@@ -209,7 +201,14 @@ const JellyfinImportModal: React.FC<JellyfinImportProps> = ({
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody className="divide-y divide-gray-700 bg-gray-600">
|
<tbody className="divide-y divide-gray-700 bg-gray-600">
|
||||||
{data?.map((user) => (
|
{data
|
||||||
|
?.filter(
|
||||||
|
(user) =>
|
||||||
|
!existingUsers?.results.some(
|
||||||
|
(u) => u.jellyfinUserId === user.id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.map((user) => (
|
||||||
<tr key={`user-${user.id}`}>
|
<tr key={`user-${user.id}`}>
|
||||||
<td className="whitespace-nowrap px-4 py-4 text-sm font-medium leading-5 text-gray-100">
|
<td className="whitespace-nowrap px-4 py-4 text-sm font-medium leading-5 text-gray-100">
|
||||||
<span
|
<span
|
||||||
|
|||||||
Reference in New Issue
Block a user