fix(web): show download button correctly based on shared link permission (#8288)

* fix(web): show download button correctly based on shared link permission

* remove console log

* Define initial value

* simpler implementation

* refactor: show download in asset viewer for shared link

* chore: hook timeout

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Alex
2024-04-03 09:37:03 -05:00
committed by GitHub
parent 15a2e6feeb
commit 7f854432ae
6 changed files with 26 additions and 14 deletions
@@ -9,6 +9,7 @@
import { handleError } from '$lib/utils/handle-error';
import { getMySharedLink, SharedLinkType } from '@immich/sdk';
import type { PageData } from './$types';
import { setSharedLink } from '$lib/utils';
export let data: PageData;
let { sharedLink, passwordRequired, sharedLinkKey: key, meta } = data;
@@ -19,6 +20,7 @@
const handlePasswordSubmit = async () => {
try {
sharedLink = await getMySharedLink({ password, key });
setSharedLink(sharedLink);
passwordRequired = false;
isOwned = $user ? $user.id === sharedLink.userId : false;
title = (sharedLink.album ? sharedLink.album.albumName : 'Public Share') + ' - Immich';
+2 -1
View File
@@ -1,4 +1,4 @@
import { getAssetThumbnailUrl } from '$lib/utils';
import { getAssetThumbnailUrl, setSharedLink } from '$lib/utils';
import { authenticate } from '$lib/utils/auth';
import { ThumbnailFormat, getMySharedLink, isHttpError } from '@immich/sdk';
import type { PageLoad } from './$types';
@@ -9,6 +9,7 @@ export const load = (async ({ params }) => {
try {
const sharedLink = await getMySharedLink({ key });
setSharedLink(sharedLink);
const assetCount = sharedLink.assets.length;
const assetId = sharedLink.album?.albumThumbnailAssetId || sharedLink.assets[0]?.id;