Skip to content

High performance self-hosted photo and video management solution.

fix(web): new album title fix (#5467)

waclaw661dc832d3928c
diff --git a/server/src/domain/album/dto/album-create.dto.ts b/server/src/domain/album/dto/album-create.dto.ts
index e95ec4a834..bebbed20bd 100644
--- a/server/src/domain/album/dto/album-create.dto.ts
+++ b/server/src/domain/album/dto/album-create.dto.ts
@@ -1,9 +1,8 @@
import { ApiProperty } from '@nestjs/swagger';
-import { IsNotEmpty, IsString } from 'class-validator';
+import { IsString } from 'class-validator';
import { Optional, ValidateUUID } from '../../domain.util';
export class CreateAlbumDto {
- @IsNotEmpty()
@IsString()
@ApiProperty()
albumName!: string;
diff --git a/web/src/lib/components/shared-components/album-selection-modal.svelte b/web/src/lib/components/shared-components/album-selection-modal.svelte
index b49ced3a0d..27460ba2aa 100644
--- a/web/src/lib/components/shared-components/album-selection-modal.svelte
+++ b/web/src/lib/components/shared-components/album-selection-modal.svelte
@@ -41,9 +41,9 @@
const handleNew = () => {
if (shared) {
- dispatch('newAlbum', { albumName: search.length > 0 ? search : 'Untitled' });
+ dispatch('newAlbum', { albumName: search.length > 0 ? search : '' });
} else {
- dispatch('newSharedAlbum', { albumName: search.length > 0 ? search : 'Untitled' });
+ dispatch('newSharedAlbum', { albumName: search.length > 0 ? search : '' });
}
};
</script>
diff --git a/web/src/routes/(user)/albums/+page.svelte b/web/src/routes/(user)/albums/+page.svelte
index c7506a6158..4f5f0b18d5 100644
--- a/web/src/routes/(user)/albums/+page.svelte
+++ b/web/src/routes/(user)/albums/+page.svelte
@@ -207,7 +207,7 @@
const removeAlbumsIfEmpty = async () => {
try {
for (const album of $albums) {
- if (album.assetCount == 0 && album.albumName == 'Untitled') {
+ if (album.assetCount == 0 && album.albumName == '') {
await deleteAlbum(album);
}
}
diff --git a/web/src/routes/(user)/albums/[albumId]/+page.svelte b/web/src/routes/(user)/albums/[albumId]/+page.svelte
index a881877135..b6373a5ac5 100644
--- a/web/src/routes/(user)/albums/[albumId]/+page.svelte
+++ b/web/src/routes/(user)/albums/[albumId]/+page.svelte
@@ -95,7 +95,7 @@
let titleInput: HTMLInputElement;
let isEditingDescription = false;
let isCreatingSharedAlbum = false;
- let currentAlbumName = '';
+ let currentAlbumName = album.albumName;
let contextMenuPosition: { x: number; y: number } = { x: 0, y: 0 };
let isShowActivity = false;
let isLiked: ActivityResponseDto | null = null;
@@ -578,6 +578,7 @@
disabled={!isOwned}
bind:this={titleInput}
title="Edit Title"
+ placeholder="Add a title"
/>
<!-- ALBUM SUMMARY -->
diff --git a/web/src/routes/(user)/albums/__tests__/albums.bloc.spec.ts b/web/src/routes/(user)/albums/__tests__/albums.bloc.spec.ts
index 660c3f195a..f9bf61179e 100644
--- a/web/src/routes/(user)/albums/__tests__/albums.bloc.spec.ts
+++ b/web/src/routes/(user)/albums/__tests__/albums.bloc.spec.ts
@@ -30,7 +30,7 @@ describe('Albums BLoC', () => {
});
it('loads albums from the server', async () => {
- // TODO: this method currently deletes albums with no assets and albumName === 'Untitled' which might not be the best approach
+ // TODO: this method currently deletes albums with no assets and albumName === '' which might not be the best approach
const loadedAlbums = [..._albums, albumFactory.build({ id: 'new_loaded_uuid' })];
apiMock.albumApi.getAllAlbums.mockResolvedValueOnce({
@@ -63,9 +63,8 @@ describe('Albums BLoC', () => {
});
it('creates a new album', async () => {
- // TODO: we probably shouldn't hardcode the album name "untitled" here and let the user input the album name before creating it
const payload: CreateAlbumDto = {
- albumName: 'Untitled',
+ albumName: '',
};
const returnedAlbum = albumFactory.build();
diff --git a/web/src/routes/(user)/albums/albums.bloc.ts b/web/src/routes/(user)/albums/albums.bloc.ts
index 6758be06b5..35a630f42f 100644
--- a/web/src/routes/(user)/albums/albums.bloc.ts
+++ b/web/src/routes/(user)/albums/albums.bloc.ts
@@ -16,9 +16,9 @@ export const useAlbums = (props: AlbumsProps) => {
const { data } = await api.albumApi.getAllAlbums();
albums.set(data);
- // Delete album that has no photos and is named 'Untitled'
+ // Delete album that has no photos and is named ''
for (const album of data) {
- if (album.albumName === 'Untitled' && album.assetCount === 0) {
+ if (album.albumName === '' && album.assetCount === 0) {
setTimeout(async () => {
await deleteAlbum(album);
}, 500);
@@ -36,7 +36,7 @@ export const useAlbums = (props: AlbumsProps) => {
try {
const { data: newAlbum } = await api.albumApi.createAlbum({
createAlbumDto: {
- albumName: 'Untitled',
+ albumName: '',
},
});
diff --git a/web/src/routes/(user)/sharing/+page.svelte b/web/src/routes/(user)/sharing/+page.svelte
index 51c0baf151..982e4c3c52 100644
--- a/web/src/routes/(user)/sharing/+page.svelte
+++ b/web/src/routes/(user)/sharing/+page.svelte
@@ -23,7 +23,7 @@
try {
const { data: newAlbum } = await api.albumApi.createAlbum({
createAlbumDto: {
- albumName: 'Untitled',
+ albumName: '',
},
});