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] } });
+});