Added Support for user reply via mail to post and comment notifications

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@117130 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-07-09 15:20:13 +00:00
parent aa8f0fe59b
commit 79c5b84b4e
2 changed files with 14 additions and 7 deletions

View File

@ -1,6 +1,7 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-14-0" <Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-14-0"
date="2015-06-18"> date="2015-07-08">
<Change>Added Support for user reply via mail to post and comment notifications</Change>
<Change>Added Notifications support for Tabular Data Manager</Change> <Change>Added Notifications support for Tabular Data Manager</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-13-1" <Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-13-1"

View File

@ -35,7 +35,7 @@ public class EmailPlugin {
private static final Logger _log = LoggerFactory.getLogger(EmailPlugin.class); private static final Logger _log = LoggerFactory.getLogger(EmailPlugin.class);
protected static final int SECONDS2WAIT = 60; protected static final int SECONDS2WAIT = 60;
public static final String WRITE_ABOVE_TO_REPLY = "- Write ABOVE THIS LINE to post a reply via email -"; public static final String WRITE_ABOVE_TO_REPLY = "- Write anywhere ABOVE THIS LINE to post a reply via email -";
private static EmailPlugin singleton; private static EmailPlugin singleton;
@ -78,7 +78,9 @@ public class EmailPlugin {
body.append("<body>"); body.append("<body>");
if (notification2Save.getType() == NotificationType.POST_ALERT) { if (notification2Save.getType() == NotificationType.POST_ALERT ||
notification2Save.getType() == NotificationType.COMMENT ||
notification2Save.getType() == NotificationType.OWN_COMMENT) {
body.append("<div>").append(WRITE_ABOVE_TO_REPLY).append("</div><br />"); body.append("<div>").append(WRITE_ABOVE_TO_REPLY).append("</div><br />");
} }
@ -128,8 +130,10 @@ public class EmailPlugin {
StringBuilder body = new StringBuilder(); StringBuilder body = new StringBuilder();
if (notification2Save.getType() == NotificationType.POST_ALERT) { if (notification2Save.getType() == NotificationType.POST_ALERT ||
body.append(WRITE_ABOVE_TO_REPLY).append("\n\n"); notification2Save.getType() == NotificationType.COMMENT ||
notification2Save.getType() == NotificationType.OWN_COMMENT) {
body.append(WRITE_ABOVE_TO_REPLY).append("\n\n");
} }
body.append("Dear ").append(userFirstName).append(",") //dear <user> body.append("Dear ").append(userFirstName).append(",") //dear <user>
@ -230,8 +234,10 @@ public class EmailPlugin {
Message msg2Return = new MimeMessage(session); Message msg2Return = new MimeMessage(session);
if (notification2Save.getType() == NotificationType.POST_ALERT) { if (notification2Save.getType() == NotificationType.POST_ALERT ||
senderEmail = "social.post@d4science.org"; notification2Save.getType() == NotificationType.COMMENT ||
notification2Save.getType() == NotificationType.OWN_COMMENT) {
senderEmail = "social.post+" + notification2Save.getSubjectid() +"@d4science.org";
} }
// EMAIL SENDER // EMAIL SENDER
msg2Return.setHeader("Content-Type", "text/html; charset=UTF-8"); msg2Return.setHeader("Content-Type", "text/html; charset=UTF-8");