feat: sort users alphabetically when adding to album (#27731)

pull/27801/head
OdinOxin 2026-04-14 21:21:22 +02:00 committed by GitHub
parent 84a1fb27ca
commit 3753b7a4d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 3 deletions

View File

@ -5,6 +5,7 @@
import { normalizeSearchString } from '$lib/utils/string-utils';
import { searchUsers, type AlbumResponseDto, type UserResponseDto } from '@immich/sdk';
import { FormModal, ListButton, LoadingSpinner, Stack, Text } from '@immich/ui';
import { sortBy } from 'lodash-es';
import { onMount } from 'svelte';
import { t } from 'svelte-i18n';
import { SvelteMap } from 'svelte/reactivity';
@ -21,9 +22,13 @@
let users: UserResponseDto[] = $state([]);
const excludedUserIds = $derived([album.ownerId, ...album.albumUsers.map(({ user: { id } }) => id)]);
const filteredUsers = $derived(
users.filter(
(user) =>
!excludedUserIds.includes(user.id) && normalizeSearchString(user.name).includes(normalizeSearchString(search)),
sortBy(
users.filter(
(user) =>
!excludedUserIds.includes(user.id) &&
normalizeSearchString(user.name).includes(normalizeSearchString(search)),
),
['name'],
),
);
const selectedUsers = new SvelteMap<string, UserResponseDto>();