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>
|
<ReleaseNotes>
|
||||||
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-14-0"
|
<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 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>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>
|
||||||
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-13-1"
|
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-13-1"
|
||||||
date="2015-05-05">
|
date="2015-05-05">
|
||||||
|
|
|
@ -105,8 +105,8 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
||||||
return applicationProfile.getUrl();
|
return applicationProfile.getUrl();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_log.warn("applicationProfile NULL or url is empty");
|
_log.warn("applicationProfile NULL or url is empty returning " + "/group/data-e-infrastructure-gateway");
|
||||||
return "";
|
return "/group/data-e-infrastructure-gateway";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -479,7 +479,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
||||||
userIdToNotify, //user no notify
|
userIdToNotify, //user no notify
|
||||||
feedid, //the post
|
feedid, //the post
|
||||||
new Date(),
|
new Date(),
|
||||||
"/group/data-e-infrastructure-gateway?oid="+feedid,
|
getApplicationUrl()+"?oid="+feedid,
|
||||||
"commented on your post: "
|
"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;\">\""
|
+ "<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>",
|
+ escapeHtml(feedText) +"\"</div>",
|
||||||
|
@ -508,7 +508,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
||||||
userIdToNotify, //user no notify
|
userIdToNotify, //user no notify
|
||||||
feedid, //the post
|
feedid, //the post
|
||||||
new Date(),
|
new Date(),
|
||||||
"/group/data-e-infrastructure-gateway?oid="+feedid,
|
getApplicationUrl()+"?oid="+feedid,
|
||||||
notificationText,
|
notificationText,
|
||||||
false,
|
false,
|
||||||
aslSession.getUsername(),
|
aslSession.getUsername(),
|
||||||
|
@ -527,7 +527,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
||||||
userIdToNotify, //user no notify
|
userIdToNotify, //user no notify
|
||||||
feedid, //the post
|
feedid, //the post
|
||||||
new Date(),
|
new Date(),
|
||||||
"/group/data-e-infrastructure-gateway?oid="+feedid,
|
getApplicationUrl()+"?oid="+feedid,
|
||||||
"commented on one of your favorite posts: "
|
"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;\">\""
|
+ "<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>",
|
+ escapeHtml(commentText) +"\"</div>",
|
||||||
|
@ -548,8 +548,9 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
||||||
userIdToNotify, //user no notify
|
userIdToNotify, //user no notify
|
||||||
feedid, //the post
|
feedid, //the post
|
||||||
new Date(),
|
new Date(),
|
||||||
"/group/data-e-infrastructure-gateway?oid="+feedid,
|
getApplicationUrl()+"?oid="+feedid,
|
||||||
"mentioned you: " + escapeHtml(feedText),
|
"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,
|
false,
|
||||||
aslSession.getUsername(),
|
aslSession.getUsername(),
|
||||||
aslSession.getUserFullName(),
|
aslSession.getUserFullName(),
|
||||||
|
@ -561,14 +562,15 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean notifyLikedFeed(String userIdToNotify, String feedid, String feedText) {
|
public boolean notifyLikedFeed(String userIdToNotify, String feedid, String feedText) {
|
||||||
Notification not = new Notification(
|
|
||||||
|
Notification not = new Notification(
|
||||||
UUID.randomUUID().toString(),
|
UUID.randomUUID().toString(),
|
||||||
NotificationType.LIKE,
|
NotificationType.LIKE,
|
||||||
userIdToNotify, //user no notify
|
userIdToNotify, //user no notify
|
||||||
feedid, //the post
|
feedid, //the post
|
||||||
new Date(),
|
new Date(),
|
||||||
"/group/data-e-infrastructure-gateway?oid="+feedid,
|
getApplicationUrl()+"?oid="+feedid,
|
||||||
"favorited one of your post",
|
"favorited/subscribed to one of your post",
|
||||||
false,
|
false,
|
||||||
aslSession.getUsername(),
|
aslSession.getUsername(),
|
||||||
aslSession.getUserFullName(),
|
aslSession.getUserFullName(),
|
||||||
|
|
|
@ -11,7 +11,6 @@ import javax.mail.internet.MimeBodyPart;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import javax.mail.internet.MimeMultipart;
|
import javax.mail.internet.MimeMultipart;
|
||||||
|
|
||||||
import org.gcube.common.portal.PortalContext;
|
|
||||||
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
|
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
|
||||||
import org.gcube.portal.databook.shared.Notification;
|
import org.gcube.portal.databook.shared.Notification;
|
||||||
import org.gcube.portal.databook.shared.NotificationType;
|
import org.gcube.portal.databook.shared.NotificationType;
|
||||||
|
@ -36,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 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;
|
private static EmailPlugin singleton;
|
||||||
|
|
||||||
|
@ -81,6 +80,7 @@ public class EmailPlugin {
|
||||||
|
|
||||||
if (notification2Save.getType() == NotificationType.POST_ALERT ||
|
if (notification2Save.getType() == NotificationType.POST_ALERT ||
|
||||||
notification2Save.getType() == NotificationType.COMMENT ||
|
notification2Save.getType() == NotificationType.COMMENT ||
|
||||||
|
notification2Save.getType() == NotificationType.MENTION ||
|
||||||
notification2Save.getType() == NotificationType.OWN_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 />");
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,9 @@ public class EmailPlugin {
|
||||||
|
|
||||||
if (notification2Save.getType() == NotificationType.POST_ALERT ||
|
if (notification2Save.getType() == NotificationType.POST_ALERT ||
|
||||||
notification2Save.getType() == NotificationType.COMMENT ||
|
notification2Save.getType() == NotificationType.COMMENT ||
|
||||||
|
notification2Save.getType() == NotificationType.MENTION ||
|
||||||
notification2Save.getType() == NotificationType.OWN_COMMENT) {
|
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>
|
body.append("Dear ").append(userFirstName).append(",") //dear <user>
|
||||||
|
@ -237,6 +238,7 @@ public class EmailPlugin {
|
||||||
|
|
||||||
if (notification2Save.getType() == NotificationType.POST_ALERT ||
|
if (notification2Save.getType() == NotificationType.POST_ALERT ||
|
||||||
notification2Save.getType() == NotificationType.COMMENT ||
|
notification2Save.getType() == NotificationType.COMMENT ||
|
||||||
|
notification2Save.getType() == NotificationType.MENTION ||
|
||||||
notification2Save.getType() == NotificationType.OWN_COMMENT) {
|
notification2Save.getType() == NotificationType.OWN_COMMENT) {
|
||||||
String[] splits = senderEmail.split("@");
|
String[] splits = senderEmail.split("@");
|
||||||
senderEmail = splits[0] + "+" + notification2Save.getSubjectid() + "@" + splits[1];
|
senderEmail = splits[0] + "+" + notification2Save.getSubjectid() + "@" + splits[1];
|
||||||
|
|
Loading…
Reference in New Issue