fix: only permit rating shortcut when rating is enabled

pull/24620/head
cbochs 2025-12-16 07:09:19 -07:00
parent 7a20282c97
commit 6878d1a5b1
No known key found for this signature in database
GPG Key ID: 5803BAE8E71DDC8E
1 changed files with 10 additions and 7 deletions

View File

@ -2,6 +2,7 @@
import { shortcuts } from '$lib/actions/shortcut';
import type { OnAction } from '$lib/components/asset-viewer/actions/action';
import { AssetAction } from '$lib/constants';
import { preferences } from '$lib/stores/user.store';
import { handleError } from '$lib/utils/handle-error';
import { toTimelineAsset } from '$lib/utils/timeline-util';
import { updateAsset, type AssetResponseDto } from '@immich/sdk';
@ -52,11 +53,13 @@
</script>
<svelte:document
use:shortcuts={[
{ shortcut: { key: '1' }, onShortcut: onShortcut1 },
{ shortcut: { key: '2' }, onShortcut: onShortcut2 },
{ shortcut: { key: '3' }, onShortcut: onShortcut3 },
{ shortcut: { key: '4' }, onShortcut: onShortcut4 },
{ shortcut: { key: '5' }, onShortcut: onShortcut5 },
]}
use:shortcuts={$preferences?.ratings.enabled
? [
{ shortcut: { key: '1' }, onShortcut: onShortcut1 },
{ shortcut: { key: '2' }, onShortcut: onShortcut2 },
{ shortcut: { key: '3' }, onShortcut: onShortcut3 },
{ shortcut: { key: '4' }, onShortcut: onShortcut4 },
{ shortcut: { key: '5' }, onShortcut: onShortcut5 },
]
: []}
/>