From 8c737f896cabbc3b602c29bab4d6d7c8fc0db56a Mon Sep 17 00:00:00 2001 From: Ebuson Date: Wed, 2 Feb 2022 19:01:09 +0200 Subject: [PATCH] fix batch add people to image --- .../gr-image-metadata/gr-image-metadata.html | 5 +++-- .../gr-image-metadata/gr-image-metadata.js | 15 ++++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/kahuna/public/js/components/gr-image-metadata/gr-image-metadata.html b/kahuna/public/js/components/gr-image-metadata/gr-image-metadata.html index 2275de8470..4f06497075 100644 --- a/kahuna/public/js/components/gr-image-metadata/gr-image-metadata.html +++ b/kahuna/public/js/components/gr-image-metadata/gr-image-metadata.html @@ -375,7 +375,7 @@ - +
diff --git a/kahuna/public/js/components/gr-image-metadata/gr-image-metadata.js b/kahuna/public/js/components/gr-image-metadata/gr-image-metadata.js index 7da1ad5976..4494754ba2 100644 --- a/kahuna/public/js/components/gr-image-metadata/gr-image-metadata.js +++ b/kahuna/public/js/components/gr-image-metadata/gr-image-metadata.js @@ -60,7 +60,6 @@ module.controller('grImageMetadataCtrl', [ inject$($scope, Rx.Observable.fromPromise(selectedUsageCategory(ctrl.usageRights)), ctrl, 'usageCategory'); ctrl.rawMetadata = rawMetadata(); ctrl.metadata = displayMetadata(); - ctrl.peopleInSelectedImages = selectedPeople(); ctrl.extraInfo = extraInfo(); if (ctrl.singleImage) { updateSingleImage(); @@ -97,7 +96,10 @@ module.controller('grImageMetadataCtrl', [ ctrl.updateMetadataField = function (field, value) { var imageArray = Array.from(ctrl.selectedImages); - + if (field === 'peopleInImage') { + ctrl.addPersonToImages(imageArray, value); + return; + } return editsService.batchUpdateMetadataField( imageArray, field, @@ -297,15 +299,6 @@ module.controller('grImageMetadataCtrl', [ return imageList.getOccurrences(labels); } - function selectedPeople() { - let peopleInSelectedImages = []; - ctrl.selectedImages.map((image) => { - const currentPeopleInImage = ctrl.peopleAccessor(image); - peopleInSelectedImages = peopleInSelectedImages.concat(currentPeopleInImage); - }); - return [... new Set(peopleInSelectedImages)]; - } - function selectedUsageRights() { return ctrl.selectedImages.map(image => { return {