Vrename is reported in the email's subject. Changelog update for the new version 0.16.0

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@124355 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
costantino.perciante 2016-02-19 13:05:20 +00:00
parent 70ca2c7904
commit 678f5f5f4a
2 changed files with 51 additions and 18 deletions

View File

@ -1,4 +1,9 @@
<ReleaseNotes>
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-16-0"
date="2016-02-29">
<Change>Added original discussion in email's body</Change>
<Change>Vre's name is now reported in email's subject</Change>
</Changeset>
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-15-0"
date="2015-10-09">
<Change>Added message body in notifications for messages
@ -7,17 +12,22 @@
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-14-0"
date="2015-07-15">
<Change>Added Support for user reply via mail to post and comment
notifications</Change>
notifications
</Change>
<Change>Added Support for user subscribe/favorite via mail to post
notifications</Change>
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>
better heuristic used
</Change>
<Change>Revised the way we format mail notification messages, user
text is now more clear and visible</Change>
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>
page
</Change>
</Changeset>
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-13-1"
date="2015-05-05">

View File

@ -174,7 +174,7 @@ public class EmailPlugin {
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())
.append(buildPlainTextDiscussion(feed, comments, commentKey))
.append(buildPlainTextDiscussion(notification2Save, feed, comments, commentKey))
.append("\n----\n")
.append("This message was sent to ")
.append(email)
@ -199,6 +199,9 @@ public class EmailPlugin {
try{
if(notification2Save.getType().equals(NotificationType.POST_ALERT) || feed == null)
return "";
String htmlPost = "<br />" + "<br />----<p>Original post:</p>";
// data formatter
Format formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm a");
@ -272,9 +275,12 @@ public class EmailPlugin {
* @param commentKey if not null, when building the discussion stop at this comment.
* @return a string representing the discussion
*/
private static String buildPlainTextDiscussion(Feed feed, List<Comment> comments, String commentKey){
private static String buildPlainTextDiscussion(Notification notification2Save, Feed feed, List<Comment> comments, String commentKey){
try{
if(notification2Save.getType().equals(NotificationType.POST_ALERT) || feed == null)
return "";
// build discussion
String discussion = "\n\n----\n\nOriginal post:";
@ -418,14 +424,31 @@ public class EmailPlugin {
msg2Return.setFrom(new InternetAddress(senderEmail, portalName));
msg2Return.addRecipient(Message.RecipientType.TO, new InternetAddress(email));
msg2Return.setSubject(getSubjectByNotificationType(notification2Save, portalUrl, vreName, user.getFirstName(), hashtags));
// retrieve post/comments from its id (if possible)
Feed feed = null;
List<Comment> comments = null;
String commentKey = null;
// retrieve post/comments from its id
String feedId = notification2Save.getSubjectid();
Feed feed = store.readFeed(feedId);
List<Comment> comments = store.getAllCommentByFeed(feedId);
Collections.sort(comments); // sort them
String commentKey = notification2Save.getCommentKey();
try{
String feedId = notification2Save.getSubjectid();
feed = store.readFeed(feedId);
comments = store.getAllCommentByFeed(feedId);
Collections.sort(comments); // sort them
commentKey = notification2Save.getCommentKey();
// try to set vreName when notification is created in infrastructure scope
String[] splittedVREName = feed.getVreid().split("/");
if(vreName == null)
vreName = splittedVREName[splittedVREName.length - 1];
}catch(Exception e){
_log.error("Unable to retrieve feeds/comments", e);
}
// set subject
msg2Return.setSubject(getSubjectByNotificationType(notification2Save, portalUrl, vreName, user.getFirstName(), hashtags));
final MimeBodyPart textPart = new MimeBodyPart();
textPart.setContent(getTextEmail(notification2Save, user.getFirstName(), portalUrl, email, feed, comments, commentKey, hashtags), "text/plain; charset=UTF-8");
@ -454,9 +477,9 @@ public class EmailPlugin {
private static String getSubjectByNotificationType(Notification notification2Save, String portalURL, String vreName, String userFirstName, String ...optionalParams) {
switch (notification2Save.getType()) {
case LIKE:
return notification2Save.getSenderFullName()+" favorited your post";
return notification2Save.getSenderFullName()+" favorited your post in " + (vreName == null? "" : vreName);
case COMMENT:
return notification2Save.getSenderFullName()+" commented on the post";
return notification2Save.getSenderFullName()+" commented on the post in " + (vreName == null? "" : vreName);
case MESSAGE:
String messageSubject = (optionalParams != null && optionalParams.length > 0) ?
optionalParams[0] : notification2Save.getSenderFullName()+" sent you a message";
@ -482,9 +505,9 @@ public class EmailPlugin {
case WP_ITEM_RENAMED:
return notification2Save.getSenderFullName()+ " renamed an item in a shared folder";
case OWN_COMMENT:
return notification2Save.getSenderFullName() + " commented on your post";
return notification2Save.getSenderFullName() + " commented on your post in " + (vreName == null? "" : vreName);
case MENTION:
return notification2Save.getSenderFullName() + " mentioned you";
return notification2Save.getSenderFullName() + " mentioned you in " + (vreName == null? "" : vreName);
case POST_ALERT:
String toReturn = notification2Save.getSenderFullName() + " shared a news on " + vreName;
if (optionalParams != null) { //in this case optionalParams are the hashtags