Skip to content

Commit

Permalink
Merge branch 'develop' into 3900-tokenless-search-api #3900
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Jun 26, 2017
2 parents d1aed43 + 7f4309b commit ee86ad3
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 13 deletions.
4 changes: 2 additions & 2 deletions doc/sphinx-guides/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
# built documents.
#
# The short X.Y version.
version = '4.6.2'
version = '4.7'
# The full version, including alpha/beta/rc tags.
release = '4.6.2'
release = '4.7'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
6 changes: 3 additions & 3 deletions doc/sphinx-guides/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Dataverse 4.6.2 Guides
======================
Dataverse 4.7 Guides
====================

These guides are for the most recent version of Dataverse. For the guides for **version 4.6.1** please go `here <http://guides.dataverse.org/en/4.6.1/>`_.
These guides are for the most recent version of Dataverse. For the guides for **version 4.6.2** please go `here <http://guides.dataverse.org/en/4.6.2/>`_.

.. toctree::
:glob:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>edu.harvard.iq</groupId>
<artifactId>dataverse</artifactId>
<version>4.6.2</version>
<version>4.7</version>
<packaging>war</packaging>

<name>dataverse</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

public class UserNotification implements Serializable {
public enum Type {
ASSIGNROLE, REVOKEROLE, CREATEDV, CREATEDS, CREATEACC, MAPLAYERUPDATED, MAPLAYERDELETEFAILED, SUBMITTEDDS, RETURNEDDS, PUBLISHEDDS, REQUESTFILEACCESS, GRANTFILEACCESS, REJECTFILEACCESS, FILESYSTEMIMPORT, CHECKSUMIMPORT, CHECKSUMFAIL
ASSIGNROLE, REVOKEROLE, CREATEDV, CREATEDS, CREATEACC, MAPLAYERUPDATED, MAPLAYERDELETEFAILED, SUBMITTEDDS, RETURNEDDS, PUBLISHEDDS, REQUESTFILEACCESS, GRANTFILEACCESS, REJECTFILEACCESS, FILESYSTEMIMPORT, CHECKSUMIMPORT, CHECKSUMFAIL, CONFIRMEMAIL
};

private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package edu.harvard.iq.dataverse.confirmemail;

import edu.harvard.iq.dataverse.Dataverse;
import edu.harvard.iq.dataverse.DataverseServiceBean;
import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser;
import edu.harvard.iq.dataverse.authorization.AuthenticationServiceBean;
import edu.harvard.iq.dataverse.MailServiceBean;
import edu.harvard.iq.dataverse.UserNotification;
import edu.harvard.iq.dataverse.authorization.providers.shib.ShibAuthenticationProvider;
import edu.harvard.iq.dataverse.util.BundleUtil;
import edu.harvard.iq.dataverse.util.MailUtil;
import edu.harvard.iq.dataverse.util.SystemConfig;
import java.sql.Timestamp;
import java.util.Arrays;
Expand Down Expand Up @@ -38,6 +42,8 @@ public class ConfirmEmailServiceBean {
@EJB
SystemConfig systemConfig;

@EJB DataverseServiceBean dataverseService;

@PersistenceContext(unitName = "VDCNet-ejbPU")
private EntityManager em;

Expand Down Expand Up @@ -102,11 +108,20 @@ private void sendLinkOnEmailChange(AuthenticatedUser aUser, String confirmationU

try {
String toAddress = aUser.getEmail();
/**
* @todo Move this to Bundle.properties.
*/
String subject = BundleUtil.getStringFromBundle("notification.email.verifyEmail.subject");
mailService.sendSystemEmail(toAddress, subject, messageBody);
try {
Dataverse rootDataverse = dataverseService.findRootDataverse();
if (rootDataverse != null) {
String rootDataverseName = rootDataverse.getName();
// FIXME: consider refactoring this into MailServiceBean.sendNotificationEmail. CONFIRMEMAIL may be the only type where we don't want an in-app notification.
UserNotification userNotification = new UserNotification();
userNotification.setType(UserNotification.Type.CONFIRMEMAIL);
String subject = MailUtil.getSubjectTextBasedOnNotification(userNotification, rootDataverseName);
logger.fine("sending email to " + toAddress + " with this subject: " + subject);
mailService.sendSystemEmail(toAddress, subject, messageBody);
}
} catch (Exception e) {
logger.info("The root dataverse is not present. Don't send a notification to dataverseAdmin.");
}
} catch (Exception ex) {
/**
* @todo get more specific about the exception that's thrown when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ public boolean ingestAsTabular(Long datafile_id) { //DataFile dataFile) throws I
if (FileUtil.MIME_TYPE_CSV_ALT.equals(dataFile.getContentType())) {
tabDataIngest.getDataTable().setOriginalFileFormat(FileUtil.MIME_TYPE_CSV);
} else {
tabDataIngest.getDataTable().setOriginalFileFormat(dataFile.getContentType());
tabDataIngest.getDataTable().setOriginalFileFormat(originalContentType);
}

dataFile.setDataTable(tabDataIngest.getDataTable());
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 @@ -64,6 +64,8 @@ public static String getSubjectTextBasedOnNotification(UserNotification userNoti
return BundleUtil.getStringFromBundle("notification.email.import.filesystem.subject", rootDvNameAsList);
case CHECKSUMIMPORT:
return BundleUtil.getStringFromBundle("notification.email.import.checksum.subject", rootDvNameAsList);
case CONFIRMEMAIL:
return BundleUtil.getStringFromBundle("notification.email.verifyEmail.subject", rootDvNameAsList);
}
return "";
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/edu/harvard/iq/dataverse/util/MailUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,10 @@ public void testSubjectChecksumImport() {
userNotification.setType(UserNotification.Type.CHECKSUMIMPORT);
assertEquals("LibraScholar: Your file checksum job has completed", MailUtil.getSubjectTextBasedOnNotification(userNotification, rootDataverseName));
}

@Test
public void testSubjectConfirmEmail() {
userNotification.setType(UserNotification.Type.CONFIRMEMAIL);
assertEquals("LibraScholar: Verify your email address", MailUtil.getSubjectTextBasedOnNotification(userNotification, rootDataverseName));
}
}

0 comments on commit ee86ad3

Please sign in to comment.