Skip to content

Commit

Permalink
fix: mobile album sync always triggered when opening the app (immich-…
Browse files Browse the repository at this point in the history
…app#14233)

* fix: mobile album sync always triggered when opening the app

* send lastModifiedAssetTimestamp when get individual album
  • Loading branch information
alextran1502 authored Nov 19, 2024
1 parent 69e50d0 commit f8bbc6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions e2e/src/api/specs/album.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ describe('/albums', () => {
expect(body).toEqual({
...user1Albums[0],
assets: [expect.objectContaining({ isFavorite: false })],
lastModifiedAssetTimestamp: expect.any(String),
});
});

Expand Down Expand Up @@ -297,6 +298,7 @@ describe('/albums', () => {
expect(body).toEqual({
...user1Albums[0],
assets: [expect.objectContaining({ id: user1Albums[0].assets[0].id })],
lastModifiedAssetTimestamp: expect.any(String),
});
});

Expand Down Expand Up @@ -327,6 +329,7 @@ describe('/albums', () => {
expect(body).toEqual({
...user1Albums[0],
assets: [expect.objectContaining({ id: user1Albums[0].assets[0].id })],
lastModifiedAssetTimestamp: expect.any(String),
});
});

Expand All @@ -340,6 +343,7 @@ describe('/albums', () => {
...user1Albums[0],
assets: [],
assetCount: 1,
lastModifiedAssetTimestamp: expect.any(String),
});
});
});
Expand Down
4 changes: 3 additions & 1 deletion server/src/services/album.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class AlbumService extends BaseService {
startDate: albumMetadata[album.id].startDate,
endDate: albumMetadata[album.id].endDate,
assetCount: albumMetadata[album.id].assetCount,
lastModifiedAssetTimestamp: lastModifiedAsset?.fileModifiedAt,
lastModifiedAssetTimestamp: lastModifiedAsset?.updatedAt,
};
}),
);
Expand All @@ -86,12 +86,14 @@ export class AlbumService extends BaseService {
const withAssets = dto.withoutAssets === undefined ? true : !dto.withoutAssets;
const album = await this.findOrFail(id, { withAssets });
const [albumMetadataForIds] = await this.albumRepository.getMetadataForIds([album.id]);
const lastModifiedAsset = await this.assetRepository.getLastUpdatedAssetForAlbumId(album.id);

return {
...mapAlbum(album, withAssets, auth),
startDate: albumMetadataForIds.startDate,
endDate: albumMetadataForIds.endDate,
assetCount: albumMetadataForIds.assetCount,
lastModifiedAssetTimestamp: lastModifiedAsset?.updatedAt,
};
}

Expand Down

0 comments on commit f8bbc6e

Please sign in to comment.