Fixed vre reported in the subject for some notifications (such as like notification, comment/own comment and mention notifications). The full discussion is now reconstructed only when one of the following notification types is used: like notification, comment/own comment and mention notifications

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@141753 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
costantino.perciante 2017-01-25 10:55:12 +00:00
parent 54db46f5f4
commit a6b39da0ba
2 changed files with 21 additions and 8 deletions

View File

@ -91,7 +91,10 @@ public class NotificationMail {
String commentKey = null;
String vreNameFromFeed = null;
if (notification2Send.getType() != NotificationType.MESSAGE) {
if (notification2Send.getType() == NotificationType.COMMENT ||
notification2Send.getType() == NotificationType.OWN_COMMENT ||
notification2Send.getType() == NotificationType.LIKE ||
notification2Send.getType() == NotificationType.MENTION) {
try{
String feedId = notification2Send.getSubjectid();
feed = store.readFeed(feedId);
@ -103,20 +106,24 @@ public class NotificationMail {
String[] splittedVREName = feed.getVreid().split("/");
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))
if(notification2Send.getType().equals(NotificationType.COMMENT) ||
notification2Send.getType().equals(NotificationType.OWN_COMMENT) ||
notification2Send.getType().equals(NotificationType.LIKE) ||
notification2Send.getType().equals(NotificationType.MENTION)
)
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 + "]");
+ vreNameToUse + "[vreNameFromFeed is " + vreNameFromFeed + ", vreName is " + vreName + "]");
// set subject
msg2Return.setSubject(SocialMailingUtil.getSubjectByNotificationType(notification2Send, vreNameToUse, user.getFirstName(), mentionedVReGroups, hashtags));

View File

@ -405,7 +405,10 @@ public class SocialMailingUtil {
try{
if(notification2Save.getType().equals(NotificationType.COMMENT) || notification2Save.getType().equals(NotificationType.LIKE)){
if (notification2Save.getType() == NotificationType.COMMENT ||
notification2Save.getType() == NotificationType.OWN_COMMENT ||
notification2Save.getType() == NotificationType.LIKE ||
notification2Save.getType() == NotificationType.MENTION){
String htmlPost = "<br />" + "<br />----<p>Original post:</p>";
// data formatter
@ -486,7 +489,10 @@ public class SocialMailingUtil {
try{
if(notification2Save.getType().equals(NotificationType.COMMENT) || notification2Save.getType().equals(NotificationType.LIKE)){
if (notification2Save.getType() == NotificationType.COMMENT ||
notification2Save.getType() == NotificationType.OWN_COMMENT ||
notification2Save.getType() == NotificationType.LIKE ||
notification2Save.getType() == NotificationType.MENTION){
// build discussion
String discussion = "\n\n----\n\nOriginal post:";