Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning to author now requires a reason that is sent by email to the author #10137

Merged
merged 11 commits into from
Mar 6, 2024
Merged
13 changes: 11 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,16 @@ public void setNumberOfFilesToShow(Long numberOfFilesToShow) {
this.numberOfFilesToShow = numberOfFilesToShow;
}

private String returnReason = "";
luddaniel marked this conversation as resolved.
Show resolved Hide resolved

public String getReturnReason() {
return returnReason;
}

public void setReturnReason(String returnReason) {
this.returnReason = returnReason;
}

public void showAll(){
setNumberOfFilesToShow(new Long(fileMetadatasSearch.size()));
}
Expand Down Expand Up @@ -2601,8 +2611,7 @@ public void edit(EditMode editMode) {

public String sendBackToContributor() {
try {
//FIXME - Get Return Comment from sendBackToContributor popup
Command<Dataset> cmd = new ReturnDatasetToAuthorCommand(dvRequestService.getDataverseRequest(), dataset, "");
Command<Dataset> cmd = new ReturnDatasetToAuthorCommand(dvRequestService.getDataverseRequest(), dataset, returnReason);
dataset = commandEngine.submit(cmd);
JsfHelper.addSuccessMessage(BundleUtil.getStringFromBundle("dataset.reject.success"));
} catch (CommandException ex) {
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/edu/harvard/iq/dataverse/MailServiceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,11 @@ public String getMessageTextBasedOnNotification(UserNotification userNotificatio
version = (DatasetVersion) targetObject;
pattern = BundleUtil.getStringFromBundle("notification.email.wasReturnedByReviewer");
String optionalReturnReason = "";
/*
FIXME
Setting up to add single comment when design completed
optionalReturnReason = ".";

if (comment != null && !comment.isEmpty()) {
optionalReturnReason = ".\n\n" + BundleUtil.getStringFromBundle("wasReturnedReason") + "\n\n" + comment;
optionalReturnReason = ".\n\n" + MessageFormat.format(BundleUtil.getStringFromBundle("notification.email.wasReturnedByReviewerReason"), comment);
luddaniel marked this conversation as resolved.
Show resolved Hide resolved
}
*/

String[] paramArrayReturnedDataset = {version.getDataset().getDisplayName(), getDatasetDraftLink(version.getDataset()),
version.getDataset().getOwner().getDisplayName(), getDataverseLink(version.getDataset().getOwner()), optionalReturnReason};
messageText += MessageFormat.format(pattern, paramArrayReturnedDataset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public Response getAllNotificationsForUser(@Context ContainerRequestContext crc)
notificationObjectBuilder.add("id", notification.getId());
notificationObjectBuilder.add("type", type.toString());
/* FIXME - Re-add reasons for return if/when they are added to the notifications page.

if (Type.RETURNEDDS.equals(type) || Type.SUBMITTEDDS.equals(type)) {
JsonArrayBuilder reasons = getReasonsForReturn(notification);
for (JsonValue reason : reasons.build()) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,8 @@ notification.email.createDataverse=Your new dataverse named {0} (view at {1} ) w
# Bundle file editors, please note that "notification.email.createDataset" is used in a unit test
notification.email.createDataset=Your new dataset named {0} (view at {1} ) was created in {2} (view at {3} ). To learn more about what you can do with a dataset, check out the Dataset Management - User Guide at {4}/{5}/user/dataset-management.html .
notification.email.wasSubmittedForReview={0} (view at {1} ) was submitted for review to be published in {2} (view at {3} ). Don''t forget to publish it or send it back to the contributor, {4} ({5})\!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
notification.email.wasSubmittedForReview={0} (view at {1} ) was submitted for review to be published in {2} (view at {3} ). Don''t forget to publish it or send it back to the contributor, {4} ({5})\!
notification.email.wasSubmittedForReview=Your dataset named {0} (view at {1} ) was submitted for review to be published in {2} (view at {3} ). Don''t forget to publish it or send it back to the contributor, {4} ({5})\!

see other comment

notification.email.wasReturnedByReviewer={0} (view at {1} ) was returned by the curator of {2} (view at {3} ).
notification.email.wasReturnedByReviewer={0} (view at {1} ) was returned by the curator of {2} (view at {3} ).{4}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be a good opportunity to be more precise :)

Suggested change
notification.email.wasReturnedByReviewer={0} (view at {1} ) was returned by the curator of {2} (view at {3} ).{4}
notification.email.wasReturnedByReviewer=Your dataset named {0} (view at {1} ) was returned by the curator of {2} (view at {3} ).{4}

Also in wasSubmittedForReview, see other suggestion

notification.email.wasReturnedByReviewerReason=See the curator comment: {0}
notification.email.wasPublished={0} (view at {1} ) was published in {2} (view at {3} ).
notification.email.publishFailedPidReg={0} (view at {1} ) in {2} (view at {3} ) could not be published due to a failure to register, or update the Global Identifier for the dataset or one of the files in it. Contact support if this continues to happen.
notification.email.closing=\n\nYou may contact us for support at {0}.\n\nThank you,\n{1}
Expand Down
31 changes: 17 additions & 14 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -1810,27 +1810,30 @@
<p class="text-warning">
<span class="glyphicon glyphicon-warning-sign"/> #{bundle['dataset.rejectMessage']}
</p>
<ui:remove>
<!--FIXME update for new comments table -->
<p:inputTextarea id="returnReason" rows="3" value="#{DatasetPage.workingVersion.returnReason}" title="#{bundle['dataset.rejectMessage.label']}" maxlength="200" widgetVar="returnReason"
cols="70" counter="display" counterTemplate="{0} characters remaining." autoResize="false"
requiredMessage="#{bundle['dataset.reject.enterReason.error']}"/>
<!--FIXME validation error msg for returnReason was in confirmDialog using testReturnReason() in commandButton below but all that was removed
as it did not look like the usual validation method, added preferred requiredMessage attribute to inputTextarea above, need wiring #5717-->
<p>
<h:outputText id="display"/>
</p>
<p:watermark for="returnReason" value="#{bundle['dataset.rejectWatermark']}" id="returnReasonwatermark"/>
</ui:remove>

<p:inputTextarea id="returnReason" rows="3" value="#{DatasetPage.returnReason}" title="#{bundle['dataset.rejectMessage.label']}" maxlength="200" widgetVar="returnReason"
cols="70" counter="display" counterTemplate="{0} characters remaining." autoResize="false"
luddaniel marked this conversation as resolved.
Show resolved Hide resolved
required="#{param['DO_RETURN_TO_AUTHOR_VALIDATION']}"
requiredMessage="#{bundle['dataset.reject.enterReason.error']}"/>
<p>
<h:outputText id="display"/>
</p>
<p:watermark for="returnReason" value="#{bundle['dataset.rejectWatermark']}" id="returnReasonWatermark"/>
<h:message for="returnReason" styleClass="bg-danger text-danger"/>

<div class="button-block">
<p:commandButton styleClass="btn btn-default" value="#{bundle.continue}" onclick="PF('sendBackToContributor').hide()" action="#{DatasetPage.sendBackToContributor}"/>
<p:commandButton styleClass="btn btn-default" value="#{bundle.continue}"
update="@form"
oncomplete="PF('sendBackToContributor').show();if (args &amp;&amp; !args.validationFailed) returnToAuthorCommand();">
<f:param name="DO_RETURN_TO_AUTHOR_VALIDATION" value="true"/>
</p:commandButton>
<button class="btn btn-link" onclick="PF('sendBackToContributor').hide();
PF('blockDatasetForm').hide();" type="button">
#{bundle.cancel}
</button>
</div>
</p:dialog>
<p:remoteCommand name="returnToAuthorCommand" action="#{DatasetPage.sendBackToContributor}"/>
<p:remoteCommand name="returnToAuthorCommand" oncomplete="PF('sendBackToContributor').hide();" update=":messagePanel" actionListener="#{DatasetPage.sendBackToContributor}"/>
luddaniel marked this conversation as resolved.
Show resolved Hide resolved
<p:remoteCommand name="linkEditTerms" actionListener="#{DatasetPage.edit('LICENSE')}" update="@form,:datasetForm,:messagePanel">
<f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}" value="0" />
</p:remoteCommand>
Expand Down
3 changes: 0 additions & 3 deletions src/main/webapp/dataverseuser.xhtml
luddaniel marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@
<o:param>
#{DataverseUserPage.getRequestorEmail(item)}
</o:param>
<o:param>
#{DataverseUserPage.getReasonForReturn(item.theObject)}
</o:param>
</h:outputFormat>
</ui:fragment>
<ui:fragment rendered="#{item.type == 'RETURNEDDS'}">
Expand Down
Loading