mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
feat: sort users alphabetically when adding to album (#27731)
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
import { normalizeSearchString } from '$lib/utils/string-utils';
|
import { normalizeSearchString } from '$lib/utils/string-utils';
|
||||||
import { searchUsers, type AlbumResponseDto, type UserResponseDto } from '@immich/sdk';
|
import { searchUsers, type AlbumResponseDto, type UserResponseDto } from '@immich/sdk';
|
||||||
import { FormModal, ListButton, LoadingSpinner, Stack, Text } from '@immich/ui';
|
import { FormModal, ListButton, LoadingSpinner, Stack, Text } from '@immich/ui';
|
||||||
|
import { sortBy } from 'lodash-es';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import { SvelteMap } from 'svelte/reactivity';
|
import { SvelteMap } from 'svelte/reactivity';
|
||||||
@@ -21,9 +22,13 @@
|
|||||||
let users: UserResponseDto[] = $state([]);
|
let users: UserResponseDto[] = $state([]);
|
||||||
const excludedUserIds = $derived([album.ownerId, ...album.albumUsers.map(({ user: { id } }) => id)]);
|
const excludedUserIds = $derived([album.ownerId, ...album.albumUsers.map(({ user: { id } }) => id)]);
|
||||||
const filteredUsers = $derived(
|
const filteredUsers = $derived(
|
||||||
users.filter(
|
sortBy(
|
||||||
(user) =>
|
users.filter(
|
||||||
!excludedUserIds.includes(user.id) && normalizeSearchString(user.name).includes(normalizeSearchString(search)),
|
(user) =>
|
||||||
|
!excludedUserIds.includes(user.id) &&
|
||||||
|
normalizeSearchString(user.name).includes(normalizeSearchString(search)),
|
||||||
|
),
|
||||||
|
['name'],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
const selectedUsers = new SvelteMap<string, UserResponseDto>();
|
const selectedUsers = new SvelteMap<string, UserResponseDto>();
|
||||||
|
|||||||
Reference in New Issue
Block a user