Fixed email's subject when comments are made at root level in news feed (the vreName is extracted from the feed)
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@129132 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1013df1f25
commit
38a879a189
|
@ -85,6 +85,7 @@ public class NotificationMail {
|
|||
Feed feed = null;
|
||||
List<Comment> comments = null;
|
||||
String commentKey = null;
|
||||
String vreNameFromFeed = null;
|
||||
|
||||
if (notification2Send.getType() != NotificationType.MESSAGE) {
|
||||
try{
|
||||
|
@ -99,19 +100,28 @@ public class NotificationMail {
|
|||
if(vreName == null)
|
||||
vreName = splittedVREName[splittedVREName.length - 1];
|
||||
|
||||
// if the notification is a comment, extract the vre name from the feed and not from the scope
|
||||
if(notification2Send.getType().equals(NotificationType.COMMENT) || notification2Send.getType().equals(NotificationType.OWN_COMMENT))
|
||||
vreNameFromFeed = splittedVREName[splittedVREName.length - 1];
|
||||
|
||||
} catch(Exception e){
|
||||
_log.error("Unable to retrieve feeds/comments", e);
|
||||
}
|
||||
}
|
||||
|
||||
String vreNameToUse = (vreNameFromFeed == null) ? vreName : vreNameFromFeed;
|
||||
|
||||
_log.debug("VRE Name for the email's subject is going to be "
|
||||
+ vreNameToUse + "[vreNameFromFeed is " + vreNameFromFeed + ", vreName is " + vreName + "]");
|
||||
|
||||
// set subject
|
||||
msg2Return.setSubject(SocialMailingUtil.getSubjectByNotificationType(notification2Send, vreName, user.getFirstName(), hashtags));
|
||||
msg2Return.setSubject(SocialMailingUtil.getSubjectByNotificationType(notification2Send, vreNameToUse, user.getFirstName(), hashtags));
|
||||
|
||||
final MimeBodyPart textPart = new MimeBodyPart();
|
||||
textPart.setContent(SocialMailingUtil.getTextEmail(notification2Send, user.getFirstName(), portalURL, siteLandingPagePath, email, feed, comments, commentKey, hashtags), "text/plain; charset=UTF-8");
|
||||
|
||||
final MimeBodyPart htmlPart = new MimeBodyPart();
|
||||
htmlPart.setContent(SocialMailingUtil.getHTMLEmail(notification2Send, user.getFirstName(), portalURL, siteLandingPagePath, email, vreName, feed, comments, commentKey, hashtags), "text/html; charset=UTF-8");
|
||||
htmlPart.setContent(SocialMailingUtil.getHTMLEmail(notification2Send, user.getFirstName(), portalURL, siteLandingPagePath, email, feed, comments, commentKey, hashtags), "text/html; charset=UTF-8");
|
||||
|
||||
final Multipart mp = new MimeMultipart("alternative");
|
||||
mp.addBodyPart(textPart);
|
||||
|
|
|
@ -45,7 +45,6 @@ public class SocialMailingUtil {
|
|||
String portalURL,
|
||||
String siteLandingPagePath,
|
||||
String email,
|
||||
String vreName,
|
||||
Feed feed,
|
||||
List<Comment> comments,
|
||||
String commentKey,
|
||||
|
|
Loading…
Reference in New Issue