fix(web): new feature photo (#9443)

* fix: new feature photo

* fix: use updatedAt
This commit is contained in:
martin 2024-06-28 02:16:26 +02:00 committed by GitHub
parent 325aa1d392
commit 37b5d92110
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 89 additions and 31 deletions

View file

@ -213,7 +213,7 @@
<ImageThumbnail
curve
shadow
url={getPeopleThumbnailUrl(person.id)}
url={getPeopleThumbnailUrl(person)}
altText={person.name}
title={person.name}
widthStyle="90px"

View file

@ -108,7 +108,7 @@
<ImageThumbnail
curve
shadow
url={getPeopleThumbnailUrl(person.id)}
url={getPeopleThumbnailUrl(person)}
altText={getPersonNameWithHiddenValue(person.name, person.isHidden)}
title={getPersonNameWithHiddenValue(person.name, person.isHidden)}
widthStyle="90px"

View file

@ -36,7 +36,7 @@
class:dark:border-immich-dark-primary={border}
class:border-immich-primary={border}
>
<ImageThumbnail {circle} url={getPeopleThumbnailUrl(person.id)} altText={person.name} widthStyle="100%" shadow />
<ImageThumbnail {circle} url={getPeopleThumbnailUrl(person)} altText={person.name} widthStyle="100%" shadow />
</div>
<div

View file

@ -38,7 +38,7 @@
<ImageThumbnail
circle
shadow
url={getPeopleThumbnailUrl(personMerge1.id)}
url={getPeopleThumbnailUrl(personMerge1)}
altText={personMerge1.name}
widthStyle="100%"
/>
@ -65,7 +65,7 @@
border={potentialMergePeople.length > 0}
circle
shadow
url={getPeopleThumbnailUrl(personMerge2.id)}
url={getPeopleThumbnailUrl(personMerge2)}
altText={personMerge2.name}
widthStyle="100%"
/>
@ -84,7 +84,7 @@
border={true}
circle
shadow
url={getPeopleThumbnailUrl(person.id)}
url={getPeopleThumbnailUrl(person)}
altText={person.name}
widthStyle="100%"
on:click={() => changePersonToMerge(person)}

View file

@ -50,7 +50,7 @@
<ImageThumbnail
shadow
{preload}
url={getPeopleThumbnailUrl(person.id)}
url={getPeopleThumbnailUrl(person)}
altText={person.name}
title={person.name}
widthStyle="100%"

View file

@ -234,7 +234,7 @@
<ImageThumbnail
curve
shadow
url={getPeopleThumbnailUrl(selectedPersonToReassign[face.id].id)}
url={getPeopleThumbnailUrl(selectedPersonToReassign[face.id])}
altText={selectedPersonToReassign[face.id].name}
title={getPersonNameWithHiddenValue(
selectedPersonToReassign[face.id].name,
@ -248,7 +248,7 @@
<ImageThumbnail
curve
shadow
url={getPeopleThumbnailUrl(face.person.id)}
url={getPeopleThumbnailUrl(face.person)}
altText={face.person.name}
title={getPersonNameWithHiddenValue(face.person.name, face.person.isHidden)}
widthStyle={thumbnailWidth}

View file

@ -71,13 +71,7 @@
: 'border-transparent'}"
on:click={() => togglePersonSelection(person.id)}
>
<ImageThumbnail
circle
shadow
url={getPeopleThumbnailUrl(person.id)}
altText={person.name}
widthStyle="100%"
/>
<ImageThumbnail circle shadow url={getPeopleThumbnailUrl(person)} altText={person.name} widthStyle="100%" />
<p class="mt-2 line-clamp-2 text-sm font-medium dark:text-white">{person.name}</p>
</button>
{/each}

View file

@ -621,6 +621,7 @@
"unable_to_save_settings": "Unable to save settings",
"unable_to_scan_libraries": "Unable to scan libraries",
"unable_to_scan_library": "Unable to scan library",
"unable_to_set_feature_photo": "Unable to set feature photo",
"unable_to_set_profile_picture": "Unable to set profile picture",
"unable_to_submit_job": "Unable to submit job",
"unable_to_trash_asset": "Unable to trash asset",

View file

@ -17,6 +17,7 @@ import {
startOAuth,
unlinkOAuthAccount,
type AssetResponseDto,
type PersonResponseDto,
type SharedLinkResponseDto,
} from '@immich/sdk';
import { mdiCogRefreshOutline, mdiDatabaseRefreshOutline, mdiImageRefreshOutline } from '@mdi/js';
@ -205,7 +206,8 @@ export const getAssetPlaybackUrl = (options: string | { id: string; checksum?: s
export const getProfileImageUrl = (userId: string) => createUrl(getUserProfileImagePath(userId));
export const getPeopleThumbnailUrl = (personId: string) => createUrl(getPeopleThumbnailPath(personId));
export const getPeopleThumbnailUrl = (person: PersonResponseDto, updatedAt?: string) =>
createUrl(getPeopleThumbnailPath(person.id), { updatedAt: updatedAt ?? person.updatedAt });
export const getAssetJobName = derived(t, ($t) => {
return (job: AssetJobName) => {

View file

@ -61,7 +61,7 @@
<ImageThumbnail
circle
shadow
url={getPeopleThumbnailUrl(person.id)}
url={getPeopleThumbnailUrl(person)}
altText={person.name}
widthStyle="100%"
/>

View file

@ -508,7 +508,7 @@
preload={searchName !== '' || index < 20}
bind:hidden={person.isHidden}
shadow
url={getPeopleThumbnailUrl(person.id)}
url={getPeopleThumbnailUrl(person)}
altText={person.name}
widthStyle="100%"
bind:eyeColor={eyeColorMap[person.id]}

View file

@ -91,7 +91,7 @@
let refreshAssetGrid = false;
let personName = '';
$: thumbnailData = getPeopleThumbnailUrl(data.person.id);
$: thumbnailData = getPeopleThumbnailUrl(data.person);
let name: string = data.person.name;
let suggestedPeople: PersonResponseDto[] = [];
@ -121,7 +121,7 @@
return websocketEvents.on('on_person_thumbnail', (personId: string) => {
if (data.person.id === personId) {
thumbnailData = getPeopleThumbnailUrl(data.person.id) + `?now=${Date.now()}`;
thumbnailData = getPeopleThumbnailUrl(data.person, Date.now().toString());
}
});
});
@ -206,10 +206,13 @@
if (viewMode !== ViewMode.SELECT_PERSON) {
return;
}
try {
await updatePerson({ id: data.person.id, personUpdateDto: { featureFaceAssetId: asset.id } });
notificationController.show({ message: $t('feature_photo_updated'), type: NotificationType.Info });
} catch (error) {
handleError(error, $t('errors.unable_to_set_feature_photo'));
}
await updatePerson({ id: data.person.id, personUpdateDto: { featureFaceAssetId: asset.id } });
notificationController.show({ message: $t('feature_photo_updated'), type: NotificationType.Info });
assetInteractionStore.clearMultiselect();
viewMode = ViewMode.VIEW_ASSETS;
@ -525,7 +528,7 @@
<ImageThumbnail
circle
shadow
url={getPeopleThumbnailUrl(person.id)}
url={getPeopleThumbnailUrl(person)}
altText={person.name}
widthStyle="2rem"
heightStyle="2rem"