passing hashtags in subject email of post notifications
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@101410 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b966420adf
commit
531ac821b1
|
@ -12,5 +12,6 @@ public class ShareUpdates implements EntryPoint {
|
||||||
|
|
||||||
public void onModuleLoad() {
|
public void onModuleLoad() {
|
||||||
RootPanel.get("shareUpdateDiv").add(new ShareUpdateForm());
|
RootPanel.get("shareUpdateDiv").add(new ShareUpdateForm());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.portlets.user.shareupdates.server;
|
package org.gcube.portlets.user.shareupdates.server;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
|
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
|
||||||
|
@ -18,22 +20,25 @@ public class PostNotificationsThread implements Runnable {
|
||||||
private String postText;
|
private String postText;
|
||||||
private String postId;
|
private String postId;
|
||||||
private String groupId;
|
private String groupId;
|
||||||
|
private List<String> hashtags;
|
||||||
private NotificationsManager nm;
|
private NotificationsManager nm;
|
||||||
|
|
||||||
public PostNotificationsThread(String postId, String postText, String groupId, NotificationsManager nm) {
|
public PostNotificationsThread(String postId, String postText, String groupId, NotificationsManager nm, List<String> hashtags) {
|
||||||
super();
|
super();
|
||||||
this.postId = postId;
|
this.postId = postId;
|
||||||
this.postText = postText;
|
this.postText = postText;
|
||||||
this.groupId = groupId;
|
this.groupId = groupId;
|
||||||
|
this.hashtags = hashtags;
|
||||||
this.nm = nm;
|
this.nm = nm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
UserManager um = new LiferayUserManager();
|
UserManager um = new LiferayUserManager();
|
||||||
|
String[] hashtagsToPass = hashtags.toArray(new String[hashtags.size()]);
|
||||||
try {
|
try {
|
||||||
for (UserModel user : um.listUsersByGroup(groupId)) {
|
for (UserModel user : um.listUsersByGroup(groupId)) {
|
||||||
boolean result = nm.notifyPost(user.getScreenName(), postId, postText);
|
boolean result = nm.notifyPost(user.getScreenName(), postId, postText, hashtagsToPass);
|
||||||
_log.trace("Sending Notification for post alert to: " + user.getScreenName() + " result?"+ result);
|
_log.trace("Sending Notification for post alert to: " + user.getScreenName() + " result?"+ result);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
_log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL");
|
_log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL");
|
||||||
user = getDevelopmentUser();
|
user = getDevelopmentUser();
|
||||||
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
|
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/USTORE_VRE");
|
||||||
}
|
}
|
||||||
return SessionManager.getInstance().getASLSession(sessionID, user);
|
return SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
||||||
//send the notification about this posts to everyone in the group if notifyGroup is true
|
//send the notification about this posts to everyone in the group if notifyGroup is true
|
||||||
if (pLevel == PrivacyLevel.SINGLE_VRE && vreId != null && vreId.compareTo("") != 0 && notifyGroup) {
|
if (pLevel == PrivacyLevel.SINGLE_VRE && vreId != null && vreId.compareTo("") != 0 && notifyGroup) {
|
||||||
NotificationsManager nm = new ApplicationNotificationsManager(session, NEWS_FEED_PORTLET_CLASSNAME);
|
NotificationsManager nm = new ApplicationNotificationsManager(session, NEWS_FEED_PORTLET_CLASSNAME);
|
||||||
Thread thread = new Thread(new PostNotificationsThread(toShare.getKey(), textToPost, ""+session.getGroupId(), nm));
|
Thread thread = new Thread(new PostNotificationsThread(toShare.getKey(), textToPost, ""+session.getGroupId(), nm, hashtags));
|
||||||
thread.start();
|
thread.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue