diff --git a/i18n/en.json b/i18n/en.json index 51bc6f99f..85478a54a 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1080,7 +1080,6 @@ "unable_to_empty_trash": "Unable to empty trash", "unable_to_enter_fullscreen": "Unable to enter fullscreen", "unable_to_exit_fullscreen": "Unable to exit fullscreen", - "unable_to_get_comments_number": "Unable to get number of comments", "unable_to_get_shared_link": "Failed to get shared link", "unable_to_hide_person": "Unable to hide person", "unable_to_leave_cluster_group": "Unable to leave cluster group", diff --git a/web/src/lib/components/asset-viewer/ActivityViewer.svelte b/web/src/lib/components/asset-viewer/ActivityViewer.svelte index e56e5ad83..f638f0f04 100644 --- a/web/src/lib/components/asset-viewer/ActivityViewer.svelte +++ b/web/src/lib/components/asset-viewer/ActivityViewer.svelte @@ -1,17 +1,18 @@ - refreshAlbum()} /> + Promise.all([refreshAlbum(), invalidateActivities({ albumId: album.id })])} +/> @@ -382,8 +389,8 @@
diff --git a/web/test/common/data.ts b/web/test/common/data.ts index cc73cfcde..c33debaad 100644 --- a/web/test/common/data.ts +++ b/web/test/common/data.ts @@ -385,6 +385,10 @@ export class MockData { removeFromAlbum(albumId: string, assetIds: string[]) { const members = this.albumAssets.get(albumId); + const removed = [...this.activities.values()].filter(({ assetId }) => assetId && assetIds.includes(assetId)); + for (const { id } of removed) { + this.activities.delete(id); + } return assetIds.map((id) => ({ id, success: members?.delete(id) ?? false })); } diff --git a/web/test/medium/specs/asset-viewer/activity.spec.ts b/web/test/medium/specs/asset-viewer/activity.spec.ts index 29bd34387..3dbfe5664 100644 --- a/web/test/medium/specs/asset-viewer/activity.spec.ts +++ b/web/test/medium/specs/asset-viewer/activity.spec.ts @@ -81,3 +81,20 @@ test('trashing a liked asset removes the like from the album activity', async ({ }); expect(api.deleteAssets).toHaveBeenCalledWith({ body: { ids: [asset.id], force: false } }); }); + +test('removing an asset from the album updates the comment count', async ({ page, data, api, app }) => { + const { album, asset, other } = setup(data); + data.addActivities([ + factory.activity({ user: other, assetId: asset.id, comment: 'on the asset' }), + factory.activity({ user: other, comment: 'on the album' }), + ]); + await page.goto(Route.viewAlbum(album)); + await expect(app.album.activity.commentsButton).toHaveText('2'); + await app.timeline.select(asset); + + await app.timeline.selectionBar.removeFromAlbum(); + + await expect(app.timeline.thumbnail(asset)).toHaveCount(0); + await expect(app.album.activity.commentsButton).toHaveText('1'); + expect(api.removeAssetFromAlbum).toHaveBeenCalledWith({ params: { id: album.id }, body: { ids: [asset.id] } }); +});