Added message body in notifications for messages

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@119551 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-10-09 08:02:47 +00:00
parent 9a95808d27
commit 4b0ade3246
5 changed files with 39 additions and 18 deletions

View File

@ -1,22 +1,35 @@
<ReleaseNotes>
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-15-0"
date="2015-10-09">
<Change>Added message body in notifications for messages
</Change>
</Changeset>
<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>
<Change>Added Support for user subscribe/favorite via mail to post 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>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>
<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">
<Change>Fix for incident #1081 Notification html email formatting
problems when post is favorited</Change>
problems when post is favorited
</Change>
</Changeset>
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-13-0"
date="2014-11-03">
<Change>Integrated notifications for set/unset shared folder
administrator</Change>
administrator
</Change>
<Change>Integrated support for hashtags </Change>
</Changeset>
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.0-12-0"

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId>
<version>0.14.1-SNAPSHOT</version>
<version>0.15.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Social Portal ASL Extension</name>
<description>

View File

@ -427,21 +427,24 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* {@inheritDoc}
*/
@Override
public boolean notifyMessageReceived(String userIdToNotify, String subject) {
public boolean notifyMessageReceived(String userIdToNotify, String messageId, String subject, String messageText) {
String[] optionalParams = {subject};
Notification not = new Notification(
UUID.randomUUID().toString(),
NotificationType.MESSAGE,
userIdToNotify, //user no notify
"messageid_not_provided", //the
messageId, //the unique identifier of the message
new Date(),
"/group/data-e-infrastructure-gateway/messages",
"sent you a message with subject: " + escapeHtml(subject),
"sent you a message: "
+ "<div style=\"margin-top: 10px; margin-bottom: 10px; margin-left: 50px; padding-left: 15px; border-left: 3px solid #ccc; font-style: italic;\">\""
+ escapeHtml(messageText) +"\"</div>",
false,
aslSession.getUsername(),
aslSession.getUserFullName(),
aslSession.getUserAvatarId());
return saveNotification(not);
return saveNotification(not, optionalParams);
}
/**
* {@inheritDoc}

View File

@ -130,10 +130,12 @@ public interface NotificationsManager {
/**
*
* @param userIdToNotify the user you want to notify
* @param messageUniqueIdentifier the unique identifier of the message
* @param subject the subject of the message sent
* @param messageText the text of the message (text/plain)
* @return true if the notification is correctly delivered, false otherwise
*/
boolean notifyMessageReceived(String userIdToNotify, String subject);
boolean notifyMessageReceived(String userIdToNotify, String messageUniqueIdentifier, String subject, String messageText);
/**
*
* @param userIdToNotify the user you want to notify

View File

@ -274,14 +274,16 @@ public class EmailPlugin {
* @param vreName
* @return
*/
private static String getSubjectByNotificationType(Notification notification2Save, String portalURL, String vreName, String userFirstName, String ...hashtags) {
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";
case COMMENT:
return notification2Save.getSenderFullName()+" commented on the post";
case MESSAGE:
return notification2Save.getSenderFullName()+ " sent you a message";
String messageSubject = (optionalParams != null && optionalParams.length > 0) ?
optionalParams[0] : notification2Save.getSenderFullName()+" sent you a message";
return messageSubject;
case WP_FOLDER_ADDEDUSER:
return "New user in a shared folder";
case WP_FOLDER_REMOVEDUSER:
@ -308,9 +310,10 @@ public class EmailPlugin {
return notification2Save.getSenderFullName() + " mentioned you";
case POST_ALERT:
String toReturn = notification2Save.getSenderFullName() + " shared a news on " + vreName;
if (hashtags != null)
for (int i = 0; i < hashtags.length; i++)
toReturn += " " + hashtags[i];
if (optionalParams != null) { //in this case optionalParams are the hashtags
for (int i = 0; i < optionalParams.length; i++)
toReturn += " " + optionalParams[i];
}
return toReturn;
case REQUEST_CONNECTION:
return "Connection request";