mirror of
https://github.com/immich-app/immich.git
synced 2024-12-28 22:51:59 +00:00
fix(web): avoid deleting empty album unexpectedly (#12175)
This commit is contained in:
parent
40327ad987
commit
67468ea367
2 changed files with 27 additions and 2 deletions
25
e2e/src/web/specs/album.e2e-spec.ts
Normal file
25
e2e/src/web/specs/album.e2e-spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { LoginResponseDto } from '@immich/sdk';
|
||||
import { test } from '@playwright/test';
|
||||
import { utils } from 'src/utils';
|
||||
|
||||
test.describe('Album', () => {
|
||||
let admin: LoginResponseDto;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
utils.initSdk();
|
||||
await utils.resetDatabase();
|
||||
admin = await utils.adminSetup();
|
||||
});
|
||||
|
||||
test(`doesn't delete album after canceling add assets`, async ({ context, page }) => {
|
||||
await utils.setAuthCookies(context, admin.accessToken);
|
||||
|
||||
await page.goto('/albums');
|
||||
await page.getByRole('button', { name: 'Create album' }).click();
|
||||
await page.getByRole('button', { name: 'Select photos' }).click();
|
||||
await page.getByRole('button', { name: 'Close' }).click();
|
||||
|
||||
await page.reload();
|
||||
await page.getByRole('button', { name: 'Select photos' }).waitFor();
|
||||
});
|
||||
});
|
|
@ -419,8 +419,8 @@
|
|||
}
|
||||
};
|
||||
|
||||
onNavigate(async () => {
|
||||
if (album.assetCount === 0 && !album.albumName) {
|
||||
onNavigate(async ({ to }) => {
|
||||
if (!isAlbumsRoute(to?.route.id) && album.assetCount === 0 && !album.albumName) {
|
||||
await deleteAlbum(album);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue