From afe925a55e8cbb7a20819890b807c2266b2996da Mon Sep 17 00:00:00 2001 From: Yaros Date: Mon, 12 Jan 2026 16:41:33 +0100 Subject: [PATCH] fix(web): show relevant navbar options for partner assets (#24832) * fix(web): show relevant navbar options for partner * fix(web): AssetSelectControlBar on photos & search routes * chore: remove duplicate AssetSelectControlBar from search * chore: formatting fix * chore: change let to const --- .../asset-viewer/asset-viewer-nav-bar.svelte | 62 +++++---- .../(user)/photos/[[assetId=id]]/+page.svelte | 85 +++++++------ .../[[assetId=id]]/+page.svelte | 120 +++++------------- 3 files changed, 116 insertions(+), 151 deletions(-) diff --git a/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte b/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte index faa81a6e92..319d382706 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte @@ -27,7 +27,7 @@ import { photoViewerImgElement } from '$lib/stores/assets-store.svelte'; import { user } from '$lib/stores/user.store'; import { photoZoomState } from '$lib/stores/zoom-image.store'; - import { getAssetJobName, withoutIcons } from '$lib/utils'; + import { getAssetJobName, getSharedLink, withoutIcons } from '$lib/utils'; import type { OnUndoDelete } from '$lib/utils/actions'; import { canCopyImageToClipboard } from '$lib/utils/asset-utils'; import { toTimelineAsset } from '$lib/utils/timeline-util'; @@ -114,6 +114,7 @@ const { Share, Download, SharedLinkDownload, Offline, Favorite, Unfavorite, PlayMotionPhoto, StopMotionPhoto, Info } = $derived(getAssetActions($t, asset)); + const sharedLink = getSharedLink(); // TODO: Enable when edits are ready for release // let showEditorButton = $derived( @@ -185,7 +186,9 @@ {#if isOwner} + {/if} + {#if !sharedLink} {#if showSlideshow && !isLocked} @@ -214,17 +217,19 @@ {/if} {/if} {/if} - {#if album} - - {/if} - {#if person} - - {/if} - {#if asset.type === AssetTypeEnum.Image && !isLocked} - - {/if} + {/if} + {#if album} + + {/if} + {#if person} + + {/if} + {#if asset.type === AssetTypeEnum.Image && !isLocked} + + {/if} - {#if !isLocked} + {#if !isLocked} + {#if isOwner} {/if} - {#if !asset.isArchived && !asset.isTrashed && smartSearchEnabled} - - goto(resolve(`${AppRoute.SEARCH}?query={"queryAssetId":"${stack?.primaryAssetId ?? asset.id}"}`))} - text={$t('view_similar_photos')} - /> - {/if} {/if} - - {#if !asset.isTrashed} - - {/if} - - {#if asset.type === AssetTypeEnum.Video} + {#if !asset.isArchived && !asset.isTrashed && smartSearchEnabled} setPlayOriginalVideo(!playOriginalVideo)} - text={playOriginalVideo ? $t('play_transcoded_video') : $t('play_original_video')} + icon={mdiCompare} + onClick={() => + goto(resolve(`${AppRoute.SEARCH}?query={"queryAssetId":"${stack?.primaryAssetId ?? asset.id}"}`))} + text={$t('view_similar_photos')} /> {/if} + {/if} + {#if !asset.isTrashed && isOwner} + + {/if} + + {#if asset.type === AssetTypeEnum.Video} + setPlayOriginalVideo(!playOriginalVideo)} + text={playOriginalVideo ? $t('play_transcoded_video') : $t('play_original_video')} + /> + {/if} + {#if isOwner}
asset.ownerId === $user.id)); + const handleEscape = () => { if ($showAssetViewer) { return; @@ -130,45 +133,51 @@
- timelineManager.update(ids, (asset) => (asset.isFavorite = isFavorite))} - > - - - {#if assetInteraction.selectedAssets.length > 1 || isAssetStackSelected} - updateStackedAssetInTimeline(timelineManager, result)} - onUnstack={(assets) => updateUnstackedAssetInTimeline(timelineManager, assets)} - /> - {/if} - {#if isLinkActionAvailable} - timelineManager.update(ids, (asset) => (asset.isFavorite = isFavorite))} + /> + + + + {#if assetInteraction.selectedAssets.length > 1 || isAssetStackSelected} + updateStackedAssetInTimeline(timelineManager, result)} + onUnstack={(assets) => updateUnstackedAssetInTimeline(timelineManager, assets)} + /> + {/if} + {#if isLinkActionAvailable} + + {/if} + + + + timelineManager.update(ids, (asset) => (asset.visibility = visibility))} /> - {/if} - - - - timelineManager.update(ids, (asset) => (asset.visibility = visibility))} - /> - {#if $preferences.tags.enabled} - - {/if} - timelineManager.removeAssets(assetIds)} - onUndoDelete={(assets) => timelineManager.upsertAssets(assets)} - /> - -
- -
+ {#if $preferences.tags.enabled} + + {/if} + timelineManager.removeAssets(assetIds)} + onUndoDelete={(assets) => timelineManager.upsertAssets(assets)} + /> + +
+ +
+ {:else} + + {/if} {/if} diff --git a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte index 0cc30c2c0a..3a91858b85 100644 --- a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -26,7 +26,7 @@ import { AssetInteraction } from '$lib/stores/asset-interaction.svelte'; import { assetViewingStore } from '$lib/stores/asset-viewing.store'; import { lang, locale } from '$lib/stores/preferences.store'; - import { preferences } from '$lib/stores/user.store'; + import { preferences, user } from '$lib/stores/user.store'; import { handlePromiseError } from '$lib/utils'; import { cancelMultiselect } from '$lib/utils/asset-utils'; import { parseUtcDate } from '$lib/utils/date-time'; @@ -71,6 +71,10 @@ let smartSearchEnabled = $derived(featureFlagsManager.value.smartSearch); let terms = $derived(searchQuery ? JSON.parse(searchQuery) : {}); + const isAllUserOwned = $derived( + $user && assetInteraction.selectedAssets.every((asset) => asset.ownerId === $user.id), + ); + $effect(() => { // we want this to *only* be reactive on `terms` // eslint-disable-next-line @typescript-eslint/no-unused-expressions @@ -258,64 +262,6 @@ -
- {#if assetInteraction.selectionActive} -
- cancelMultiselect(assetInteraction)} - > - - - - - - - { - for (const assetId of assetIds) { - const asset = searchResultAssets.find((searchAsset) => searchAsset.id === assetId); - if (asset) { - asset.isFavorite = isFavorite; - } - } - }} - /> - - - - - - - {#if $preferences.tags.enabled && assetInteraction.isAllUserOwned} - - {/if} - -
- -
-
-
- {:else} -
- goto(previousRoute)} backIcon={mdiArrowLeft}> -
-
- -
-
-
- {/if} -
- {#if terms}
- { - for (const id of ids) { - const asset = searchResultAssets.find((asset) => asset.id === id); - if (asset) { - asset.isFavorite = isFavorite; + {#if isAllUserOwned} + { + for (const id of ids) { + const asset = searchResultAssets.find((asset) => asset.id === id); + if (asset) { + asset.isFavorite = isFavorite; + } } - } - }} - /> + }} + /> - - - - - - - {#if assetInteraction.isAllUserOwned} - - {/if} - {#if $preferences.tags.enabled && assetInteraction.isAllUserOwned} - - {/if} - -
- -
+ + + + + + + {#if assetInteraction.isAllUserOwned} + + {/if} + {#if $preferences.tags.enabled && assetInteraction.isAllUserOwned} + + {/if} + +
+ +
+ {:else} + + {/if} {:else}