From 32fa994fa6b99f4f952442099e8b56dd2ceca5e0 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Thu, 25 Feb 2016 17:46:38 +0000 Subject: [PATCH] Discussion is now reported in email's body, upgraded deprecated methods of asl social git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-mail-servlet@124599 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/changelog.xml | 5 +++-- pom.xml | 2 +- .../gcube/portal/socialmail/PeriodicTask.java | 17 ++++++++++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/distro/changelog.xml b/distro/changelog.xml index 9569358..e508097 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,9 +1,10 @@ - Discussion is now reported in email's body + Upgraded deprecated methods of asl social - Removed the part the export users to LDAP diff --git a/pom.xml b/pom.xml index 68947d3..b2f1d21 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.gcube.portal social-mail-servlet war - 1.3.1-SNAPSHOT + 1.4.0-SNAPSHOT social-mail-servlet Webapp This component read periodically email replies from user wanting to reply to a post via email diff --git a/src/main/java/org/gcube/portal/socialmail/PeriodicTask.java b/src/main/java/org/gcube/portal/socialmail/PeriodicTask.java index ba3f558..c05a874 100644 --- a/src/main/java/org/gcube/portal/socialmail/PeriodicTask.java +++ b/src/main/java/org/gcube/portal/socialmail/PeriodicTask.java @@ -27,6 +27,7 @@ import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager; import org.gcube.applicationsupportlayer.social.NotificationsManager; import org.gcube.applicationsupportlayer.social.mailing.AppType; import org.gcube.applicationsupportlayer.social.mailing.EmailPlugin; +import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser; import org.gcube.common.homelibrary.home.HomeLibrary; import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; @@ -265,7 +266,11 @@ public class PeriodicTask implements Runnable { if (newMessageId != null) { _log.debug("Sending message notifications ... "); List recipients = getUsersbyUserId(recipientIds); - NotificationsManager nm = new ApplicationNotificationsManager(fakeSession); + + NotificationsManager nm = new ApplicationNotificationsManager( + fakeSession.getScope(), + new SocialNetworkingUser(fakeSession.getUsername(), fakeSession.getUserEmailAddress(), fakeSession.getUserFullName(), fakeSession.getUserAvatarId()) + ); Thread thread = new Thread(new MessageNotificationsThread(recipients, newMessageId, subject, messageText, nm)); thread.start(); } else { @@ -371,7 +376,10 @@ public class PeriodicTask implements Runnable { String feedOwnerId = feed.getEntityId(); boolean isAppFeed = feed.isApplicationFeed(); - NotificationsManager nm = new ApplicationNotificationsManager(fakeSession); + NotificationsManager nm = new ApplicationNotificationsManager( + fakeSession.getScope(), + new SocialNetworkingUser(fakeSession.getUsername(), fakeSession.getUserEmailAddress(), fakeSession.getUserFullName(), fakeSession.getUserAvatarId()) + ); if (! fakeSession.getUsername().equals(feedOwnerId) && (!isAppFeed)) { boolean result = nm.notifyLikedFeed(feedOwnerId, feedId, ""); _log.trace("Like Notification to post owner added? " + result); @@ -398,7 +406,10 @@ public class PeriodicTask implements Runnable { boolean isAppFeed = feed.isApplicationFeed(); //if the user who commented this post is not the user who posted it notifies the poster user (Feed owner) - NotificationsManager nm = new ApplicationNotificationsManager(fakeSession); + NotificationsManager nm = new ApplicationNotificationsManager( + fakeSession.getScope(), + new SocialNetworkingUser(fakeSession.getUsername(), fakeSession.getUserEmailAddress(), fakeSession.getUserFullName(), fakeSession.getUserAvatarId()) + ); if (! fakeSession.getUsername().equals(feedOwnerId) && (!isAppFeed)) { boolean result = nm.notifyOwnCommentReply(feedOwnerId, feedId, commentText, comment.getKey()); _log.trace("Comment Notification to post owner added? " + result);