Skip to content

Commit

Permalink
fix(web): prevent new uploads from temporarily showing in trash (#10348)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelheusschen authored Jun 15, 2024
1 parent aea1c46 commit dfad4f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions web/src/lib/stores/asset.store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ describe('AssetStore', () => {
expect(updateAssetsSpy).toBeCalledWith([asset]);
expect(assetStore.assets.length).toEqual(1);
});

it('ignores trashed assets when isTrashed is true', () => {
const asset = assetFactory.build({ isTrashed: false });
const trashedAsset = assetFactory.build({ isTrashed: true });

const assetStore = new AssetStore({ isTrashed: true });
assetStore.addAssets([asset, trashedAsset]);
expect(assetStore.assets).toEqual([trashedAsset]);
});
});

describe('updateAssets', () => {
Expand Down
3 changes: 2 additions & 1 deletion web/src/lib/stores/assets.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ export class AssetStore {
this.options.personId ||
this.options.albumId ||
isMismatched(this.options.isArchived, asset.isArchived) ||
isMismatched(this.options.isFavorite, asset.isFavorite)
isMismatched(this.options.isFavorite, asset.isFavorite) ||
isMismatched(this.options.isTrashed, asset.isTrashed)
) {
// If asset is already in the bucket we don't need to recalculate
// asset store containers
Expand Down

0 comments on commit dfad4f0

Please sign in to comment.