Skip to content

Commit

Permalink
add brand to email subject on account create #3611 #2710
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Jun 7, 2017
1 parent 585ec73 commit 8d4ebdf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ notification.email.maplayer.deletefailed.text=We failed to delete the WorldMap l
notification.email.submit.dataset.subject=Dataverse: Your dataset has been submitted for review
notification.email.publish.dataset.subject=Dataverse: Your dataset has been published
notification.email.returned.dataset.subject=Dataverse: Your dataset has been returned
notification.email.create.account.subject=Dataverse: Your account has been created
notification.email.create.account.subject={0}: Your account has been created
notification.email.assign.role.subject=Dataverse: You have been assigned a role
notification.email.revoke.role.subject=Dataverse: Your role has been revoked
notification.email.verifyEmail.subject=Dataverse: Verify your email address
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/MailServiceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ public Boolean sendNotificationEmail(UserNotification notification){
}

private String getSubjectTextBasedOnNotification(UserNotification userNotification) {
String rootDataverseName = dataverseService.findRootDataverse().getName();
switch (userNotification.getType()) {
case ASSIGNROLE:
return ResourceBundle.getBundle("Bundle").getString("notification.email.assign.role.subject");
Expand All @@ -229,7 +230,7 @@ private String getSubjectTextBasedOnNotification(UserNotification userNotificati
case RETURNEDDS:
return ResourceBundle.getBundle("Bundle").getString("notification.email.returned.dataset.subject");
case CREATEACC:
return ResourceBundle.getBundle("Bundle").getString("notification.email.create.account.subject");
return BundleUtil.getStringFromBundle("notification.email.create.account.subject", Arrays.asList(BrandingUtil.getInstallationBrandName(rootDataverseName)));
case CHECKSUMFAIL:
return ResourceBundle.getBundle("Bundle").getString("notification.email.checksumfail.subject");
case FILESYSTEMIMPORT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ public void testEmailClosing() {
message);
}

@Test
public void testEmailSubject() {
System.out.println("testEmailSubject");
String message = BundleUtil.getStringFromBundle("notification.email.create.account.subject",
Arrays.asList(
"LibraScholar"
));
System.out.println("message: " + message);
assertEquals("LibraScholar: Your account has been created",
message);
}

@Test
public void testGetContactHeader() {
System.out.println("testGetContactHeader");
Expand Down

0 comments on commit 8d4ebdf

Please sign in to comment.