Added Support for user subscribe/favorite via mail to post notifications
Revised the way we shorten posts' text when this is very long, better heuristic used Revised the way we format mail notification messages, user text is now more clear and visible Revised the way we provide back links for posts, removed assumption that News Feed is always present the default community page git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@117263 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
aa32741422
commit
2075061724
|
@ -1,8 +1,12 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-14-0"
|
||||
date="2015-07-08">
|
||||
date="2015-07-15">
|
||||
<Change>Added Support for user reply via mail to post and comment notifications</Change>
|
||||
<Change>Added Support for user subscribe/favorite via mail to post notifications</Change>
|
||||
<Change>Added Notifications support for Tabular Data Manager</Change>
|
||||
<Change>Revised the way we shorten posts' text when this is very long, better heuristic used</Change>
|
||||
<Change>Revised the way we format mail notification messages, user text is now more clear and visible</Change>
|
||||
<Change>Revised the way we provide back links for posts, removed assumption that News Feed is always present the default community page</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-13-1"
|
||||
date="2015-05-05">
|
||||
|
|
|
@ -105,8 +105,8 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
|||
return applicationProfile.getUrl();
|
||||
}
|
||||
else {
|
||||
_log.warn("applicationProfile NULL or url is empty");
|
||||
return "";
|
||||
_log.warn("applicationProfile NULL or url is empty returning " + "/group/data-e-infrastructure-gateway");
|
||||
return "/group/data-e-infrastructure-gateway";
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -479,7 +479,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
|||
userIdToNotify, //user no notify
|
||||
feedid, //the post
|
||||
new Date(),
|
||||
"/group/data-e-infrastructure-gateway?oid="+feedid,
|
||||
getApplicationUrl()+"?oid="+feedid,
|
||||
"commented on your post: "
|
||||
+ "<div style=\"margin-top: 10px; margin-bottom: 10px; margin-left: 50px; padding-left: 15px; border-left: 3px solid #ccc; font-style: italic;\">\""
|
||||
+ escapeHtml(feedText) +"\"</div>",
|
||||
|
@ -508,7 +508,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
|||
userIdToNotify, //user no notify
|
||||
feedid, //the post
|
||||
new Date(),
|
||||
"/group/data-e-infrastructure-gateway?oid="+feedid,
|
||||
getApplicationUrl()+"?oid="+feedid,
|
||||
notificationText,
|
||||
false,
|
||||
aslSession.getUsername(),
|
||||
|
@ -527,7 +527,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
|||
userIdToNotify, //user no notify
|
||||
feedid, //the post
|
||||
new Date(),
|
||||
"/group/data-e-infrastructure-gateway?oid="+feedid,
|
||||
getApplicationUrl()+"?oid="+feedid,
|
||||
"commented on one of your favorite posts: "
|
||||
+ "<div style=\"margin-top: 10px; margin-bottom: 10px; margin-left: 50px; padding-left: 15px; border-left: 3px solid #ccc; font-style: italic;\">\""
|
||||
+ escapeHtml(commentText) +"\"</div>",
|
||||
|
@ -548,8 +548,9 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
|||
userIdToNotify, //user no notify
|
||||
feedid, //the post
|
||||
new Date(),
|
||||
"/group/data-e-infrastructure-gateway?oid="+feedid,
|
||||
"mentioned you: " + escapeHtml(feedText),
|
||||
getApplicationUrl()+"?oid="+feedid,
|
||||
"mentioned you: " + "<div style=\"margin-top: 10px; margin-bottom: 10px; margin-left: 50px; padding-left: 15px; border-left: 3px solid #ccc; font-style: italic;\">\""
|
||||
+ escapeHtml(feedText) +"\"</div>",
|
||||
false,
|
||||
aslSession.getUsername(),
|
||||
aslSession.getUserFullName(),
|
||||
|
@ -561,14 +562,15 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
|||
*/
|
||||
@Override
|
||||
public boolean notifyLikedFeed(String userIdToNotify, String feedid, String feedText) {
|
||||
Notification not = new Notification(
|
||||
|
||||
Notification not = new Notification(
|
||||
UUID.randomUUID().toString(),
|
||||
NotificationType.LIKE,
|
||||
userIdToNotify, //user no notify
|
||||
feedid, //the post
|
||||
new Date(),
|
||||
"/group/data-e-infrastructure-gateway?oid="+feedid,
|
||||
"favorited one of your post",
|
||||
getApplicationUrl()+"?oid="+feedid,
|
||||
"favorited/subscribed to one of your post",
|
||||
false,
|
||||
aslSession.getUsername(),
|
||||
aslSession.getUserFullName(),
|
||||
|
|
|
@ -11,7 +11,6 @@ import javax.mail.internet.MimeBodyPart;
|
|||
import javax.mail.internet.MimeMessage;
|
||||
import javax.mail.internet.MimeMultipart;
|
||||
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
|
||||
import org.gcube.portal.databook.shared.Notification;
|
||||
import org.gcube.portal.databook.shared.NotificationType;
|
||||
|
@ -36,7 +35,7 @@ public class EmailPlugin {
|
|||
|
||||
private static final Logger _log = LoggerFactory.getLogger(EmailPlugin.class);
|
||||
protected static final int SECONDS2WAIT = 60;
|
||||
public static final String WRITE_ABOVE_TO_REPLY = "- Write anywhere ABOVE THIS LINE to post a reply via email -";
|
||||
public static final String WRITE_ABOVE_TO_REPLY = "- Write ABOVE THIS LINE to post a reply via email, reply with empty msg to subscribe -";
|
||||
|
||||
private static EmailPlugin singleton;
|
||||
|
||||
|
@ -57,7 +56,7 @@ public class EmailPlugin {
|
|||
String removedMarkup = notification2Save.getDescription().replaceAll("&", "&");
|
||||
removedMarkup = removedMarkup.replaceAll(">", ">");
|
||||
removedMarkup = removedMarkup.replaceAll("<", "<");
|
||||
|
||||
|
||||
if (hashtags != null && hashtags.length > 0) {
|
||||
_log.debug("editing hyperlinks for mail client");
|
||||
//notification2Save uri contains the absoulte path to the feed in the correct channel, e.g. /group/ustore_vre?oid=f1637958-34d0-48fc-b5ad-13b1116e389d
|
||||
|
@ -78,13 +77,14 @@ public class EmailPlugin {
|
|||
StringBuilder body = new StringBuilder();
|
||||
|
||||
body.append("<body>");
|
||||
|
||||
|
||||
if (notification2Save.getType() == NotificationType.POST_ALERT ||
|
||||
notification2Save.getType() == NotificationType.COMMENT ||
|
||||
notification2Save.getType() == NotificationType.MENTION ||
|
||||
notification2Save.getType() == NotificationType.OWN_COMMENT) {
|
||||
body.append("<div>").append(WRITE_ABOVE_TO_REPLY).append("</div><br />");
|
||||
}
|
||||
|
||||
|
||||
body.append("<div style=\"color:#000; font-size:13px; font-family:'lucida grande',tahoma,verdana,arial,sans-serif;\">")
|
||||
.append("Dear ").append(userFirstName).append(",") //dear <user>
|
||||
.append("<p>").append(sender).append(" ").append(removedMarkup) // has done something
|
||||
|
@ -121,7 +121,7 @@ public class EmailPlugin {
|
|||
}
|
||||
}
|
||||
_log.debug("*****removedMarkup=\n" + removedMarkup);
|
||||
|
||||
|
||||
String sender = notification2Save.getSenderFullName();
|
||||
if (notification2Save.getType() == NotificationType.DOCUMENT_WORKFLOW_STEP_REQUEST_TASK)
|
||||
sender = "";
|
||||
|
@ -133,10 +133,11 @@ public class EmailPlugin {
|
|||
|
||||
if (notification2Save.getType() == NotificationType.POST_ALERT ||
|
||||
notification2Save.getType() == NotificationType.COMMENT ||
|
||||
notification2Save.getType() == NotificationType.MENTION ||
|
||||
notification2Save.getType() == NotificationType.OWN_COMMENT) {
|
||||
body.append(WRITE_ABOVE_TO_REPLY).append("\n\n");
|
||||
body.append(WRITE_ABOVE_TO_REPLY).append("\n\n");
|
||||
}
|
||||
|
||||
|
||||
body.append("Dear ").append(userFirstName).append(",") //dear <user>
|
||||
.append("\n").append(sender).append(" ").append(removedMarkup) // has done something
|
||||
.append("\nsee: ").append(portalURL).append(notification2Save.getUri())
|
||||
|
@ -237,6 +238,7 @@ public class EmailPlugin {
|
|||
|
||||
if (notification2Save.getType() == NotificationType.POST_ALERT ||
|
||||
notification2Save.getType() == NotificationType.COMMENT ||
|
||||
notification2Save.getType() == NotificationType.MENTION ||
|
||||
notification2Save.getType() == NotificationType.OWN_COMMENT) {
|
||||
String[] splits = senderEmail.split("@");
|
||||
senderEmail = splits[0] + "+" + notification2Save.getSubjectid() + "@" + splits[1];
|
||||
|
|
Loading…
Reference in New Issue