Skip to content

Commit 9bd4c9d

Browse files
Merge pull request #810 from AtlasOfLivingAustralia/hotfix/4.2.1
Hotfix/4.2.1
2 parents df8031e + 63163d6 commit 9bd4c9d

File tree

7 files changed

+13
-14
lines changed

7 files changed

+13
-14
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
profileHubVersion=4.2
1+
profileHubVersion=4.2.1-SNAPSHOT
22
grailsVersion=5.2.4
33
grailsGradlePluginVersion=5.2.3
44
groovyVersion=3.0.11

grails-app/assets/javascripts/profileEditor/directives/imageUpload.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ profileEditor.directive('imageUpload', function ($browser, $http, config) {
103103
$scope.metadata.created = util.formatLocalDate($scope.metadata.created);
104104
$cacheFactory.get('$http').removeAll();
105105

106-
profileService.saveImageMetadata($scope.image.imageId, $scope.metadata).then(function(data) {
106+
profileService.saveImageMetadata(util.getEntityId("opus"), $scope.image.imageId, $scope.metadata).then(function(data) {
107107
if (angular.isDefined($scope.callbackHandler)) {
108108
$scope.callbackHandler(data);
109109
}

grails-app/assets/javascripts/profileEditor/services/ProfileService.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -586,12 +586,12 @@ profileEditor.service('profileService', function ($http, util, $cacheFactory, co
586586
return util.toStandardPromise(future);
587587
},
588588

589-
saveImageMetadata: function(imageId, data) {
589+
saveImageMetadata: function(opusId, imageId, data) {
590590
$log.debug("Saving image metadata: " + imageId);
591591
var future = null;
592-
if (imageId) {
592+
if (opusId && imageId) {
593593
future = enqueue(function() {
594-
return $http.post(util.contextRoot() + "/image/" + imageId + "/metadata", data)
594+
return $http.post(util.contextRoot() + "/opus/" + opusId + "/image/" + imageId + "/metadata", data)
595595
});
596596
}
597597

grails-app/controllers/au/org/ala/profile/hub/ProfileController.groovy

+3-3
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ class ProfileController extends BaseController {
172172
@Secured(role = ROLE_PROFILE_EDITOR)
173173
def updateLocalImageMetadata() {
174174
def metadata = request.getJSON()
175-
if (!params.imageId || !metadata) {
176-
badRequest "imageId or metadata is required"
175+
if (!params.opusId || !params.imageId || !metadata) {
176+
badRequest "opusId, imageId and metadata is required"
177177
} else {
178-
handle imageService.updateLocalImageMetadata(params.imageId, metadata)
178+
handle imageService.updateLocalImageMetadata(params.opusId, params.imageId, metadata)
179179
}
180180
}
181181

grails-app/controllers/au/org/ala/profile/hub/UrlMappings.groovy

+1-2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class UrlMappings {
122122

123123
"/opus/$opusId/statistics" controller: "statistics", action: [GET: "index"]
124124
"/opus/$opusId/image/$filename" controller: "opus", action: [GET: "downloadImage", DELETE: "deleteImage"]
125+
"/opus/$opusId/image/$imageId/metadata" controller: "profile", action: [POST: "updateLocalImageMetadata"]
125126
"/opus/$opusId/image" controller: "opus", action: [POST: "uploadImage", PUT: "uploadImage"]
126127

127128
"/opus/$opusId/update" controller: "opus", action: [GET: "edit", POST: "updateOpus"]
@@ -187,8 +188,6 @@ class UrlMappings {
187188
"/publication/$pubId" controller: "profile", action: [GET: "getPublication"]
188189
"/publication/$pubId/json" controller: "profile", action: [GET: "getPublicationJson"]
189190

190-
"/image/$imageId/metadata" controller: "profile", action: [POST: "updateLocalImageMetadata"]
191-
192191
"/" controller: "opus", action: [GET: "index"]
193192

194193
"/logout/logout" controller: "logout", action: "logout"

grails-app/services/au/org/ala/profile/hub/ImageService.groovy

+2-2
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,8 @@ class ImageService {
668668
return ImageOption.byName(displayOptionStr, defaultOption) == ImageOption.INCLUDE
669669
}
670670

671-
def updateLocalImageMetadata(String imageId, Map metadata) {
672-
webService.post("${grailsApplication.config.profile.service.url}/image/${encPath(imageId)}/metadata", metadata, [:], ContentType.APPLICATION_JSON, true, false, profileService.getCustomHeaderWithUserId())
671+
def updateLocalImageMetadata(String opusId, String imageId, Map metadata) {
672+
webService.post("${grailsApplication.config.getProperty('profile.service.url')}/opus/${opusId}/image/${encPath(imageId)}/metadata", metadata, [:], ContentType.APPLICATION_JSON, true, false, profileService.getCustomHeaderWithUserId())
673673
}
674674

675675
def publishPrivateImage(String opusId, String profileId, String imageId) {

src/test/js/specs/services/ProfileServiceSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,9 @@ describe("ProfileService tests", function () {
428428

429429
it("should invoke the updateLocalImageMetadata service on the context root when saveImageMetadata is called", function() {
430430
var data = {creator: "one", createdDate: new Date(), rights: "rights", licence: "licence"};
431-
service.saveImageMetadata('abcdefghijlkmnop', data);
431+
service.saveImageMetadata('opusId', 'abcdefghijlkmnop', data);
432432

433-
http.expectPOST("/someContext/image/abcdefghijlkmnop/metadata", data).respond("bla");
433+
http.expectPOST("/someContext/opus/opusId/image/abcdefghijlkmnop/metadata", data).respond("bla");
434434
});
435435

436436
it("should invoke GET request when getImageMetadata is called", function() {

0 commit comments

Comments
 (0)