Skip to content

Commit

Permalink
corrected Archived subject in mail
Browse files Browse the repository at this point in the history
  • Loading branch information
ffritze committed Oct 23, 2024
1 parent e839b84 commit 443d0a3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/main/java/edu/harvard/iq/dataverse/MailServiceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -520,16 +520,18 @@ public String getMessageTextBasedOnNotification(UserNotification userNotificatio
version = (DatasetVersion) targetObject;
pattern = BundleUtil.getStringFromBundle("notification.email.wasPublished");

if (version.getVersionNote() != null) {
if (version.getVersionNote().equals("Archived Dataset")) {
pattern = BundleUtil.getStringFromBundle("notification.email.wasArchived");
}
}

String[] paramArrayPublishedDataset = {version.getDataset().getDisplayName(), getDatasetLink(version.getDataset()),
version.getDataset().getOwner().getDisplayName(), getDataverseLink(version.getDataset().getOwner())};
messageText += MessageFormat.format(pattern, paramArrayPublishedDataset);
return messageText;
case ARCHIVEDDS:
version = (DatasetVersion) targetObject;
pattern = BundleUtil.getStringFromBundle("notification.email.wasArchived");

String[] paramArrayArchivedDataset = {version.getDataset().getDisplayName(), getDatasetLink(version.getDataset()),
version.getDataset().getOwner().getDisplayName(), getDataverseLink(version.getDataset().getOwner())};
messageText += MessageFormat.format(pattern, paramArrayArchivedDataset);
return messageText;
case PUBLISHFAILED_PIDREG:
version = (DatasetVersion) targetObject;
pattern = BundleUtil.getStringFromBundle("notification.email.publishFailedPidReg");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
public class UserNotification implements Serializable {
// Keep in sync with list at admin/user-administration.rst
public enum Type {
ASSIGNROLE, REVOKEROLE, CREATEDV, CREATEDS, CREATEACC, SUBMITTEDDS, RETURNEDDS,
ARCHIVEDDS, ASSIGNROLE, REVOKEROLE, CREATEDV, CREATEDS, CREATEACC, SUBMITTEDDS, RETURNEDDS,
PUBLISHEDDS, REQUESTFILEACCESS, GRANTFILEACCESS, REJECTFILEACCESS, FILESYSTEMIMPORT,
CHECKSUMIMPORT, CHECKSUMFAIL, CONFIRMEMAIL, APIGENERATED, INGESTCOMPLETED, INGESTCOMPLETEDWITHERRORS,
PUBLISHFAILED_PIDREG, WORKFLOW_SUCCESS, WORKFLOW_FAILURE, STATUSUPDATED, DATASETCREATED, DATASETMENTIONED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public boolean onSuccess(CommandContext ctxt, Object r) {

try {
// Success! - send notification:
notifyUsersDatasetPublishStatus(ctxt, dataset, UserNotification.Type.PUBLISHEDDS);
notifyUsersDatasetPublishStatus(ctxt, dataset, UserNotification.Type.ARCHIVEDDS);
} catch (Exception e) {
logger.warning("Failure to send dataset published messages for : " + dataset.getId() + " : " + e.getMessage());
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/util/MailUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public static String getSubjectTextBasedOnNotification(UserNotification userNoti
return BundleUtil.getStringFromBundle("notification.email.create.dataset.subject", Arrays.asList(rootDvNameAsList.get(0), datasetDisplayName));
case SUBMITTEDDS:
return BundleUtil.getStringFromBundle("notification.email.submit.dataset.subject", Arrays.asList(rootDvNameAsList.get(0), datasetDisplayName));
case ARCHIVEDDS:
return BundleUtil.getStringFromBundle("notification.email.archive.dataset.subject", Arrays.asList(rootDvNameAsList.get(0), datasetDisplayName));
case PUBLISHEDDS:
return BundleUtil.getStringFromBundle("notification.email.publish.dataset.subject", Arrays.asList(rootDvNameAsList.get(0), datasetDisplayName));
case PUBLISHFAILED_PIDREG:
Expand Down
1 change: 1 addition & 0 deletions src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ notification.email.grant.file.access.subject={0}: You have been granted access t
notification.email.rejected.file.access.subject={0}: Your request for access to a restricted file has been rejected
notification.email.submit.dataset.subject={0}: Dataset "{1}" has been submitted for review
notification.email.publish.dataset.subject={0}: Dataset "{1}" has been published
notification.email.archive.dataset.subject={0}: Dataset "{1}" has been archived
notification.email.publishFailure.dataset.subject={0}: Failed to publish your dataset "{1}"
notification.email.returned.dataset.subject={0}: Dataset "{1}" has been returned
notification.email.workflow.success.subject={0}: Dataset "{1}" has been processed
Expand Down

0 comments on commit 443d0a3

Please sign in to comment.