mirror of
https://github.com/immich-app/immich.git
synced 2025-01-02 12:48:35 +02:00
fix(mobile): stack entity handling (#6980)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
fb8be51ff2
commit
ec5e4dbcc2
@ -34,7 +34,10 @@ class Asset {
|
|||||||
isTrashed = remote.isTrashed,
|
isTrashed = remote.isTrashed,
|
||||||
isReadOnly = remote.isReadOnly,
|
isReadOnly = remote.isReadOnly,
|
||||||
isOffline = remote.isOffline,
|
isOffline = remote.isOffline,
|
||||||
stackParentId = remote.stackParentId,
|
// workaround to nullify stackParentId for the parent asset until we refactor the mobile app
|
||||||
|
// stack handling to properly handle it
|
||||||
|
stackParentId =
|
||||||
|
remote.stackParentId == remote.id ? null : remote.stackParentId,
|
||||||
stackCount = remote.stackCount;
|
stackCount = remote.stackCount;
|
||||||
|
|
||||||
Asset.local(AssetEntity local, List<int> hash)
|
Asset.local(AssetEntity local, List<int> hash)
|
||||||
@ -290,7 +293,6 @@ class Asset {
|
|||||||
width: a.width ?? width,
|
width: a.width ?? width,
|
||||||
height: a.height ?? height,
|
height: a.height ?? height,
|
||||||
exifInfo: a.exifInfo?.copyWith(id: id) ?? exifInfo,
|
exifInfo: a.exifInfo?.copyWith(id: id) ?? exifInfo,
|
||||||
stackCount: a.stackCount ?? stackCount,
|
|
||||||
);
|
);
|
||||||
} else if (isRemote) {
|
} else if (isRemote) {
|
||||||
return _copyWith(
|
return _copyWith(
|
||||||
@ -305,7 +307,9 @@ class Asset {
|
|||||||
id: id,
|
id: id,
|
||||||
remoteId: remoteId,
|
remoteId: remoteId,
|
||||||
livePhotoVideoId: livePhotoVideoId,
|
livePhotoVideoId: livePhotoVideoId,
|
||||||
stackParentId: stackParentId,
|
// workaround to nullify stackParentId for the parent asset until we refactor the mobile app
|
||||||
|
// stack handling to properly handle it
|
||||||
|
stackParentId: stackParentId == remoteId ? null : stackParentId,
|
||||||
stackCount: stackCount,
|
stackCount: stackCount,
|
||||||
isFavorite: isFavorite,
|
isFavorite: isFavorite,
|
||||||
isArchived: isArchived,
|
isArchived: isArchived,
|
||||||
@ -323,8 +327,10 @@ class Asset {
|
|||||||
width: a.width,
|
width: a.width,
|
||||||
height: a.height,
|
height: a.height,
|
||||||
livePhotoVideoId: a.livePhotoVideoId,
|
livePhotoVideoId: a.livePhotoVideoId,
|
||||||
stackParentId: a.stackParentId,
|
// workaround to nullify stackParentId for the parent asset until we refactor the mobile app
|
||||||
stackCount: a.stackCount ?? stackCount,
|
// stack handling to properly handle it
|
||||||
|
stackParentId: a.stackParentId == a.remoteId ? null : a.stackParentId,
|
||||||
|
stackCount: a.stackCount,
|
||||||
// isFavorite + isArchived are not set by device-only assets
|
// isFavorite + isArchived are not set by device-only assets
|
||||||
isFavorite: a.isFavorite,
|
isFavorite: a.isFavorite,
|
||||||
isArchived: a.isArchived,
|
isArchived: a.isArchived,
|
||||||
|
@ -113,7 +113,7 @@ export class AssetService {
|
|||||||
const userId = dto.userId || auth.user.id;
|
const userId = dto.userId || auth.user.id;
|
||||||
await this.access.requirePermission(auth, Permission.TIMELINE_READ, userId);
|
await this.access.requirePermission(auth, Permission.TIMELINE_READ, userId);
|
||||||
const assets = await this.assetRepositoryV1.getAllByUserId(userId, dto);
|
const assets = await this.assetRepositoryV1.getAllByUserId(userId, dto);
|
||||||
return assets.map((asset) => mapAsset(asset));
|
return assets.map((asset) => mapAsset(asset, { withStack: true }));
|
||||||
}
|
}
|
||||||
|
|
||||||
async serveThumbnail(auth: AuthDto, assetId: string, dto: GetAssetThumbnailDto): Promise<ImmichFileResponse> {
|
async serveThumbnail(auth: AuthDto, assetId: string, dto: GetAssetThumbnailDto): Promise<ImmichFileResponse> {
|
||||||
|
Loading…
Reference in New Issue
Block a user