Feature #12613 Replace use of "$" character with "_" when sending notification emails about posts and messages

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@172022 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2018-10-08 10:34:59 +00:00
parent 672f88c274
commit 9cf69e4e99
2 changed files with 19 additions and 4 deletions

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Social Portal ASL Extension</name>
<description>

View File

@ -68,17 +68,32 @@ public class NotificationMail {
String email = user.getEmail();
Message msg2Return = new MimeMessage(session);
if (notification2Send.getType() == NotificationType.POST_ALERT ||
notification2Send.getType() == NotificationType.COMMENT ||
notification2Send.getType() == NotificationType.MENTION ||
notification2Send.getType() == NotificationType.OWN_COMMENT) {
String[] splits = senderEmail.split("@");
senderEmail = splits[0] + "+" + notification2Send.getSubjectid() + "$" + AppType.POST + "@" + splits[1];
StringBuilder sb = new StringBuilder(splits[0]);
sb.append("+")
.append(notification2Send.getSubjectid())
.append("_")
.append(AppType.POST)
.append("@")
.append(splits[1]);
senderEmail = sb.toString();
}
if (notification2Send.getType() == NotificationType.MESSAGE) {
String[] splits = senderEmail.split("@");
senderEmail = splits[0] + "+" + notification2Send.getSubjectid() + "$" + AppType.MSG + "@" + splits[1];
StringBuilder sb = new StringBuilder(splits[0]);
sb.append("+")
.append(notification2Send.getSubjectid())
.append("_")
.append(AppType.MSG)
.append("@")
.append(splits[1]);
senderEmail = sb.toString();
}
// EMAIL SENDER
msg2Return.setHeader("Content-Type", "text/html; charset=UTF-8");
@ -117,7 +132,7 @@ public class NotificationMail {
vreNameFromFeed = splittedVREName[splittedVREName.length - 1];
} catch(Exception e){
_log.error("Unable to retrieve feeds/comments", e);
_log.error("Unable to retrieve posts/comments", e);
}
}