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

* new album title fix

* Naming

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
waclaw66 2023-12-04 17:22:31 +01:00 committed by GitHub
parent 1a63d3837e
commit 1dc832d392
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 13 deletions

View file

@ -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;

View file

@ -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>

View file

@ -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);
}
}

View file

@ -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 -->

View file

@ -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();

View file

@ -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: '',
},
});

View file

@ -23,7 +23,7 @@
try {
const { data: newAlbum } = await api.albumApi.createAlbum({
createAlbumDto: {
albumName: 'Untitled',
albumName: '',
},
});