This commit is contained in:
Zack Pollard 2024-09-19 23:03:12 +01:00
parent ba0d5410cd
commit b40c52fd63
4 changed files with 15 additions and 7 deletions

View File

@ -31,6 +31,7 @@ class Asset {
isFavorite = remote.isFavorite,
isArchived = remote.isArchived,
isTrashed = remote.isTrashed,
isOffline = remote.isOffline,
// workaround to nullify stackPrimaryAssetId for the parent asset until we refactor the mobile app
// stack handling to properly handle it
stackPrimaryAssetId = remote.stack?.primaryAssetId == remote.id
@ -62,6 +63,7 @@ class Asset {
this.stackId,
this.stackPrimaryAssetId,
this.stackCount = 0,
this.isOffline = false,
this.thumbhash,
});
@ -133,6 +135,8 @@ class Asset {
bool isTrashed;
bool isOffline;
@ignore
ExifInfo? exifInfo;
@ -250,6 +254,7 @@ class Asset {
isFavorite != a.isFavorite ||
isArchived != a.isArchived ||
isTrashed != a.isTrashed ||
isOffline != a.isOffline ||
a.exifInfo?.latitude != exifInfo?.latitude ||
a.exifInfo?.longitude != exifInfo?.longitude ||
// no local stack count or different count from remote
@ -295,6 +300,7 @@ class Asset {
isFavorite: isFavorite,
isArchived: isArchived,
isTrashed: isTrashed,
isOffline: isOffline,
);
}
} else {
@ -317,6 +323,7 @@ class Asset {
isFavorite: a.isFavorite,
isArchived: a.isArchived,
isTrashed: a.isTrashed,
isOffline: a.isOffline,
exifInfo: a.exifInfo?.copyWith(id: id) ?? exifInfo,
thumbhash: a.thumbhash,
);
@ -350,6 +357,7 @@ class Asset {
bool? isFavorite,
bool? isArchived,
bool? isTrashed,
bool? isOffline,
ExifInfo? exifInfo,
String? stackId,
String? stackPrimaryAssetId,
@ -374,6 +382,7 @@ class Asset {
isFavorite: isFavorite ?? this.isFavorite,
isArchived: isArchived ?? this.isArchived,
isTrashed: isTrashed ?? this.isTrashed,
isOffline: isOffline ?? this.isOffline,
exifInfo: exifInfo ?? this.exifInfo,
stackId: stackId ?? this.stackId,
stackPrimaryAssetId: stackPrimaryAssetId ?? this.stackPrimaryAssetId,
@ -439,6 +448,7 @@ class Asset {
"height": ${height ?? "N/A"},
"isArchived": $isArchived,
"isTrashed": $isTrashed,
"isOffline": $isOffline,
}""";
}
}

View File

@ -141,7 +141,7 @@ export interface AssetUpdateDuplicateOptions {
duplicateIds: string[];
}
export type AssetPathEntity = Pick<AssetEntity, 'id' | 'originalPath'>;
export type AssetPathEntity = Pick<AssetEntity, 'id' | 'originalPath' | 'isOffline'>;
export const IAssetRepository = 'IAssetRepository';

View File

@ -59,9 +59,8 @@
export let onClose: () => void;
const sharedLink = getSharedLink();
$: isOffline = asset.isOffline;
$: isOwner = $user && asset.ownerId === $user?.id;
$: showDownloadButton = sharedLink ? sharedLink.allowDownload : !isOffline;
$: showDownloadButton = sharedLink ? sharedLink.allowDownload : !asset.isOffline;
// $: showEditorButton =
// isOwner &&
// asset.type === AssetTypeEnum.Image &&
@ -86,7 +85,7 @@
{#if !asset.isTrashed && $user}
<ShareAction {asset} />
{/if}
{#if isOffline}
{#if asset.isOffline}
<CircleIconButton color="alert" icon={mdiAlertOutline} on:click={onShowDetail} title={$t('asset_offline')} />
{/if}
{#if asset.livePhotoVideoId}
@ -136,7 +135,7 @@
{#if showDownloadButton}
<DownloadAction {asset} menuItem />
{/if}
{#if asset.status === AssetStatus.TRASHED}
{#if asset.isTrashed}
<RestoreAction {asset} {onAction} />
{:else}
<AddToAlbumAction {asset} {onAction} />

View File

@ -72,7 +72,6 @@
}
}
$: isOffline = asset.isOffline;
$: isOwner = $user?.id === asset.ownerId;
const handleNewAsset = async (newAsset: AssetResponseDto) => {
@ -142,7 +141,7 @@
<p class="text-lg text-immich-fg dark:text-immich-dark-fg">{$t('info')}</p>
</div>
{#if isOffline}
{#if asset.isOffline}
<section class="px-4 py-4">
<div role="alert">
<div class="rounded-t bg-red-500 px-4 py-2 font-bold text-white">