mirror of
https://github.com/immich-app/immich.git
synced 2025-06-04 22:24:26 -04:00
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:
parent
1a63d3837e
commit
1dc832d392
@ -1,9 +1,8 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { IsNotEmpty, IsString } from 'class-validator';
|
import { IsString } from 'class-validator';
|
||||||
import { Optional, ValidateUUID } from '../../domain.util';
|
import { Optional, ValidateUUID } from '../../domain.util';
|
||||||
|
|
||||||
export class CreateAlbumDto {
|
export class CreateAlbumDto {
|
||||||
@IsNotEmpty()
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
albumName!: string;
|
albumName!: string;
|
||||||
|
@ -41,9 +41,9 @@
|
|||||||
|
|
||||||
const handleNew = () => {
|
const handleNew = () => {
|
||||||
if (shared) {
|
if (shared) {
|
||||||
dispatch('newAlbum', { albumName: search.length > 0 ? search : 'Untitled' });
|
dispatch('newAlbum', { albumName: search.length > 0 ? search : '' });
|
||||||
} else {
|
} else {
|
||||||
dispatch('newSharedAlbum', { albumName: search.length > 0 ? search : 'Untitled' });
|
dispatch('newSharedAlbum', { albumName: search.length > 0 ? search : '' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -207,7 +207,7 @@
|
|||||||
const removeAlbumsIfEmpty = async () => {
|
const removeAlbumsIfEmpty = async () => {
|
||||||
try {
|
try {
|
||||||
for (const album of $albums) {
|
for (const album of $albums) {
|
||||||
if (album.assetCount == 0 && album.albumName == 'Untitled') {
|
if (album.assetCount == 0 && album.albumName == '') {
|
||||||
await deleteAlbum(album);
|
await deleteAlbum(album);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@
|
|||||||
let titleInput: HTMLInputElement;
|
let titleInput: HTMLInputElement;
|
||||||
let isEditingDescription = false;
|
let isEditingDescription = false;
|
||||||
let isCreatingSharedAlbum = false;
|
let isCreatingSharedAlbum = false;
|
||||||
let currentAlbumName = '';
|
let currentAlbumName = album.albumName;
|
||||||
let contextMenuPosition: { x: number; y: number } = { x: 0, y: 0 };
|
let contextMenuPosition: { x: number; y: number } = { x: 0, y: 0 };
|
||||||
let isShowActivity = false;
|
let isShowActivity = false;
|
||||||
let isLiked: ActivityResponseDto | null = null;
|
let isLiked: ActivityResponseDto | null = null;
|
||||||
@ -578,6 +578,7 @@
|
|||||||
disabled={!isOwned}
|
disabled={!isOwned}
|
||||||
bind:this={titleInput}
|
bind:this={titleInput}
|
||||||
title="Edit Title"
|
title="Edit Title"
|
||||||
|
placeholder="Add a title"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- ALBUM SUMMARY -->
|
<!-- ALBUM SUMMARY -->
|
||||||
|
@ -30,7 +30,7 @@ describe('Albums BLoC', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('loads albums from the server', async () => {
|
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' })];
|
const loadedAlbums = [..._albums, albumFactory.build({ id: 'new_loaded_uuid' })];
|
||||||
|
|
||||||
apiMock.albumApi.getAllAlbums.mockResolvedValueOnce({
|
apiMock.albumApi.getAllAlbums.mockResolvedValueOnce({
|
||||||
@ -63,9 +63,8 @@ describe('Albums BLoC', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('creates a new album', async () => {
|
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 = {
|
const payload: CreateAlbumDto = {
|
||||||
albumName: 'Untitled',
|
albumName: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const returnedAlbum = albumFactory.build();
|
const returnedAlbum = albumFactory.build();
|
||||||
|
@ -16,9 +16,9 @@ export const useAlbums = (props: AlbumsProps) => {
|
|||||||
const { data } = await api.albumApi.getAllAlbums();
|
const { data } = await api.albumApi.getAllAlbums();
|
||||||
albums.set(data);
|
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) {
|
for (const album of data) {
|
||||||
if (album.albumName === 'Untitled' && album.assetCount === 0) {
|
if (album.albumName === '' && album.assetCount === 0) {
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await deleteAlbum(album);
|
await deleteAlbum(album);
|
||||||
}, 500);
|
}, 500);
|
||||||
@ -36,7 +36,7 @@ export const useAlbums = (props: AlbumsProps) => {
|
|||||||
try {
|
try {
|
||||||
const { data: newAlbum } = await api.albumApi.createAlbum({
|
const { data: newAlbum } = await api.albumApi.createAlbum({
|
||||||
createAlbumDto: {
|
createAlbumDto: {
|
||||||
albumName: 'Untitled',
|
albumName: '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
try {
|
try {
|
||||||
const { data: newAlbum } = await api.albumApi.createAlbum({
|
const { data: newAlbum } = await api.albumApi.createAlbum({
|
||||||
createAlbumDto: {
|
createAlbumDto: {
|
||||||
albumName: 'Untitled',
|
albumName: '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user