Skip to content

Commit

Permalink
Allow moving selected photos to a different person
Browse files Browse the repository at this point in the history
fixes nextcloud/recognize#602

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Jan 4, 2023
1 parent 1c748c3 commit d063b10
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/views/FaceContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@
<Star slot="icon" />
{{ t('photos', 'Remove from favorites') }}
</NcActionButton>
<NcActionButton :close-after-click="true"
@click="showMoveModal = true">
<template #icon>
<AccountSwitch />
</template>
{{ n('photos', 'Move photo to a different person', 'Move photos to a different person', selectedFileIds.length) }}
</NcActionButton>
<NcActionButton :close-after-click="true"
@click="handleRemoveFilesFromFace(selectedFileIds)">
<template #icon>
Expand Down Expand Up @@ -160,6 +167,11 @@
@close="showMergeModal = false">
<FaceMergeForm :first-face="faceName" @select="handleMerge($event)" />
</NcModal>
<NcModal v-if="showMoveModal"
:title="t('photos', 'Merge person')"
@close="showMoveModal = false">
<FaceMergeForm :first-face="faceName" @select="handleMove($event, selectedFileIds)" />
</NcModal>
</div>
</template>

Expand All @@ -173,6 +185,7 @@ import Download from 'vue-material-design-icons/Download'
import Send from 'vue-material-design-icons/Send'
import Merge from 'vue-material-design-icons/Merge'
import ArrowLeft from 'vue-material-design-icons/ArrowLeft'
import AccountSwitch from 'vue-material-design-icons/AccountSwitch'
import AccountBoxMultipleOutline from 'vue-material-design-icons/AccountBoxMultipleOutline'
import { NcActions, NcActionButton, NcModal, NcEmptyContent, NcButton, NcLoadingIcon } from '@nextcloud/vue'
Expand Down Expand Up @@ -207,6 +220,7 @@ export default {
NcActionButton,
NcModal,
NcButton,
AccountSwitch,
},
directives: {
Expand All @@ -230,6 +244,7 @@ export default {
data() {
return {
showMoveModal: false,
showMergeModal: false,
showRenameModal: false,
loadingCount: 0,
Expand Down Expand Up @@ -348,6 +363,18 @@ export default {
}
},
async handleMove(faceName, fileIds) {
try {
this.loadingCount++
await this.moveFilesToFace({ oldFace: this.faceName, faceName, fileIdsToMove: fileIds })
this.showMoveModal = false
} catch (error) {
logger.error(error)
} finally {
this.loadingCount--
}
},
async favoriteSelection() {
try {
this.loadingCount++
Expand Down

0 comments on commit d063b10

Please sign in to comment.