Immich : demander confirmation avant de remplacer un portrait existant

L'association remplaçait et supprimait le portrait en place sans rien
demander. Le serveur refuse maintenant le remplacement d'un portrait
existant (409 avatar_exists), quelle que soit son origine, tant que la
requête ne porte pas replaceAvatar ; le panneau Immich transforme ce
refus en demande de confirmation avant de rejouer la requête. Sans
vignette Immich, l'association ne touche pas au portrait et aucune
confirmation n'est demandée.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Mistral Vibe committed 2026-10-13 15:58:32 +02:00
1 parent a3386824d3
commit 0bda88920d
6 files changed
+121 -13

No files matched your search

+4 -2
View File
@@ -70,10 +70,12 @@ export async function fetchImmichThumbnail(treeId, immichPersonId, token) {
return URL.createObjectURL(await response.blob())
}
export async function assignImmichPerson(treeId, personId, immichPersonId, token) {
export async function assignImmichPerson(treeId, personId, immichPersonId, token, { replaceAvatar = false } = {}) {
return apiRequest(`/trees/${encodeURIComponent(treeId)}/immich/assign`, withAuth({
method: 'POST',
body: JSON.stringify({ personId, immichPersonId }),
// replaceAvatar : accord explicite pour remplacer un portrait déjà en place — le serveur
// refuse sinon (409 avatar_exists), quelle que soit l'origine du portrait actuel.
body: JSON.stringify({ personId, immichPersonId, ...(replaceAvatar ? { replaceAvatar: true } : {}) }),
}, token))
}