mirror of
https://github.com/immich-app/immich.git
synced 2026-02-11 11:27:56 +03:00
move sorting to backend
This commit is contained in:
@@ -136,6 +136,16 @@ export const mapAlbum = (entity: AlbumEntity, withAssets: boolean, auth?: AuthDt
|
||||
}
|
||||
}
|
||||
|
||||
albumUsers.sort((a, b) => {
|
||||
if (a.role === AlbumUserRole.VIEWER && b.role === AlbumUserRole.EDITOR) {
|
||||
return 1;
|
||||
}
|
||||
if (a.role === AlbumUserRole.EDITOR && b.role === AlbumUserRole.VIEWER) {
|
||||
return -1;
|
||||
}
|
||||
return a.user.name.localeCompare(b.user.name);
|
||||
});
|
||||
|
||||
const assets = entity.assets || [];
|
||||
|
||||
const hasSharedLink = entity.sharedLinks?.length > 0;
|
||||
|
||||
@@ -99,15 +99,7 @@
|
||||
<p class="text-sm">Owner</p>
|
||||
</div>
|
||||
</div>
|
||||
{#each album.albumUsers.toSorted((a, b) => {
|
||||
if (a.role === AlbumUserRole.Viewer && b.role === AlbumUserRole.Editor) {
|
||||
return 1;
|
||||
}
|
||||
if (a.role === AlbumUserRole.Editor && b.role === AlbumUserRole.Viewer) {
|
||||
return -1;
|
||||
}
|
||||
return a.user.name.localeCompare(b.user.name);
|
||||
}) as { user, role }}
|
||||
{#each album.albumUsers as { user, role }}
|
||||
<div
|
||||
class="flex w-full place-items-center justify-between gap-4 p-5 rounded-xl transition-colors hover:bg-gray-50 dark:hover:bg-gray-700"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user