Skip to content

Commit

Permalink
fix Dataverse UI ability to set GB at request param
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Sep 20, 2023
1 parent d06259f commit 3ad53d7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/main/java/edu/harvard/iq/dataverse/DvObjectContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,15 @@ public boolean getEffectiveGuestbookEntryAtRequest() {
return gbAtRequest;
}

public Boolean getGuestbookEntryAtRequest() {
return guestbookAtRequest;
public String getGuestbookEntryAtRequest() {
if(guestbookAtRequest==null) {
return UNDEFINED_CODE;
}
return Boolean.valueOf(guestbookAtRequest).toString();
}

public void setGuestbookEntryAtRequest(String gbAtRequest) {
if (gbAtRequest != null && gbAtRequest.equals(UNDEFINED_CODE)) {
if (gbAtRequest == null || gbAtRequest.equals(UNDEFINED_CODE)) {
this.guestbookAtRequest = null;
} else {
//Force to true or false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ public Map<String, String> getGuestbookEntryOptions(DvObjectContainer target) {
useDefault = (defaultOption ? atRequest : atDownload)
+ BundleUtil.getStringFromBundle("dataverse.inherited");
}
currentMap.put("null", useDefault);
currentMap.put(DvObjectContainer.UNDEFINED_CODE, useDefault);
currentMap.put(Boolean.toString(true), atRequest);
currentMap.put(Boolean.toString(false), atDownload);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/api/Datasets.java
Original file line number Diff line number Diff line change
Expand Up @@ -3888,8 +3888,8 @@ public Response getGuestbookEntryOption(@Context ContainerRequestContext crc, @P
} catch (WrappedResponse ex) {
return error(Response.Status.NOT_FOUND, "No such dataset");
}
Boolean gbAtRequest = dataset.getGuestbookEntryAtRequest();
if(gbAtRequest == null) {
String gbAtRequest = dataset.getGuestbookEntryAtRequest();
if(gbAtRequest == null || gbAtRequest.equals(DvObjectContainer.UNDEFINED_CODE)) {
return ok("Not set on dataset, using the default: " + dataset.getEffectiveGuestbookEntryAtRequest());
}
return ok(dataset.getEffectiveGuestbookEntryAtRequest());
Expand Down

0 comments on commit 3ad53d7

Please sign in to comment.