mirror of https://github.com/nextcloud/photos
Fix renaming faces: Do not delete existing face when renaming
fixes https://github.com/nextcloud/recognize/issues/408 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
parent
4e75f6bf26
commit
2f4e8f5a78
|
@ -195,17 +195,20 @@ const actions = {
|
|||
let face = state.faces[oldName]
|
||||
|
||||
try {
|
||||
if (state.faces[faceName]) {
|
||||
throw new Error('Name already exists')
|
||||
}
|
||||
await client.moveFile(
|
||||
`/recognize/${getCurrentUser()?.uid}/faces/${oldName}`,
|
||||
`/recognize/${getCurrentUser()?.uid}/faces/${faceName}`,
|
||||
)
|
||||
context.commit('removeFaces', { faceNames: [oldName] })
|
||||
face = { ...face, basename: faceName }
|
||||
context.commit('addFaces', { faces: [face] })
|
||||
} catch (error) {
|
||||
logger.error(t('photos', 'Failed to rename {oldName} to {faceName}.', { oldName, faceName }), { error })
|
||||
showError(t('photos', 'Failed to rename {oldName} to {faceName}.', { oldName, faceName }))
|
||||
} finally {
|
||||
context.commit('addFaces', { faces: [face] })
|
||||
throw error
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue