1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-26 10:50:29 +02:00

fix(web): cannot view publlic shared album (#3829)

This commit is contained in:
Alex 2023-08-22 08:05:48 +02:00 committed by GitHub
parent d7f52739e8
commit 3b11be2859
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View File

@ -27,7 +27,6 @@
export let assetInteractionStore: AssetInteractionStore; export let assetInteractionStore: AssetInteractionStore;
const { selectedGroup, selectedAssets, assetSelectionCandidates, isMultiSelectState } = assetInteractionStore; const { selectedGroup, selectedAssets, assetSelectionCandidates, isMultiSelectState } = assetInteractionStore;
const dispatch = createEventDispatcher<{ const dispatch = createEventDispatcher<{
select: { title: string; assets: AssetResponseDto[] }; select: { title: string; assets: AssetResponseDto[] };
selectAssets: AssetResponseDto; selectAssets: AssetResponseDto;
@ -97,7 +96,7 @@
return; return;
} }
assetViewingStore.setAssetId(asset.id); assetViewingStore.setAssetId(asset.id, publicSharedKey);
}; };
const handleSelectGroup = (title: string, assets: AssetResponseDto[]) => dispatch('select', { title, assets }); const handleSelectGroup = (title: string, assets: AssetResponseDto[]) => dispatch('select', { title, assets });

View File

@ -24,7 +24,6 @@
export let assetInteractionStore: AssetInteractionStore; export let assetInteractionStore: AssetInteractionStore;
export let removeAction: AssetAction | null = null; export let removeAction: AssetAction | null = null;
export let publicSharedKey: string | undefined = undefined; export let publicSharedKey: string | undefined = undefined;
const { assetSelectionCandidates, assetSelectionStart, selectedGroup, selectedAssets, isMultiSelectState } = const { assetSelectionCandidates, assetSelectionStart, selectedGroup, selectedAssets, isMultiSelectState } =
assetInteractionStore; assetInteractionStore;
const viewport: Viewport = { width: 0, height: 0 }; const viewport: Viewport = { width: 0, height: 0 };
@ -98,7 +97,7 @@
const handlePrevious = async () => { const handlePrevious = async () => {
const previousAsset = await assetStore.getPreviousAssetId($viewingAsset.id); const previousAsset = await assetStore.getPreviousAssetId($viewingAsset.id);
if (previousAsset) { if (previousAsset) {
assetViewingStore.setAssetId(previousAsset); assetViewingStore.setAssetId(previousAsset, publicSharedKey);
} }
return !!previousAsset; return !!previousAsset;
@ -107,7 +106,7 @@
const handleNext = async () => { const handleNext = async () => {
const nextAsset = await assetStore.getNextAssetId($viewingAsset.id); const nextAsset = await assetStore.getNextAssetId($viewingAsset.id);
if (nextAsset) { if (nextAsset) {
assetViewingStore.setAssetId(nextAsset); assetViewingStore.setAssetId(nextAsset, publicSharedKey);
} }
return !!nextAsset; return !!nextAsset;
@ -372,6 +371,7 @@
on:unarchived={({ detail: asset }) => handleAction(asset, AssetAction.UNARCHIVE)} on:unarchived={({ detail: asset }) => handleAction(asset, AssetAction.UNARCHIVE)}
on:favorite={({ detail: asset }) => handleAction(asset, AssetAction.FAVORITE)} on:favorite={({ detail: asset }) => handleAction(asset, AssetAction.FAVORITE)}
on:unfavorite={({ detail: asset }) => handleAction(asset, AssetAction.UNFAVORITE)} on:unfavorite={({ detail: asset }) => handleAction(asset, AssetAction.UNFAVORITE)}
{publicSharedKey}
/> />
{/if} {/if}
</Portal> </Portal>

View File

@ -5,8 +5,8 @@ function createAssetViewingStore() {
const viewingAssetStoreState = writable<AssetResponseDto>(); const viewingAssetStoreState = writable<AssetResponseDto>();
const viewState = writable<boolean>(false); const viewState = writable<boolean>(false);
const setAssetId = async (id: string) => { const setAssetId = async (id: string, key?: string) => {
const { data } = await api.assetApi.getAssetById({ id }); const { data } = await api.assetApi.getAssetById({ id, key });
viewingAssetStoreState.set(data); viewingAssetStoreState.set(data);
viewState.set(true); viewState.set(true);
}; };