diff --git a/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Comments.java b/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Comments.java index 2a27812..eec4b94 100644 --- a/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Comments.java +++ b/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Comments.java @@ -200,7 +200,7 @@ public class Comments { String userid = username; Date time = new Date(); - String postOwnerId = CassandraConnection.getInstance().getDatabookStore().readPost(postId).getKey(); + String postOwnerId = CassandraConnection.getInstance().getDatabookStore().readPost(postId).getEntityId(); Comment theComment = SocialUtils.commentPost(userid, time, postId, commentText, postOwnerId, context); if (theComment != null) logger.info("Added comment " + theComment.toString()); diff --git a/src/main/java/org/gcube/portal/social/networking/ws/utils/SocialUtils.java b/src/main/java/org/gcube/portal/social/networking/ws/utils/SocialUtils.java index 10fd727..c1b6e91 100644 --- a/src/main/java/org/gcube/portal/social/networking/ws/utils/SocialUtils.java +++ b/src/main/java/org/gcube/portal/social/networking/ws/utils/SocialUtils.java @@ -556,10 +556,10 @@ public class SocialUtils { //if the comment was correctly delivered notify users involved SocialNetworkingUser socialUser = new SocialNetworkingUser(userid, email, fullName, thumbnailURL); - NotificationsManager nm = new ApplicationNotificationsManager(UserManagerWSBuilder.getInstance().getUserManager(), site, context, socialUser, NEWS_FEED_PORTLET_CLASSNAME); + NotificationsManager nm = new ApplicationNotificationsManager(uManager, site, context, socialUser, NEWS_FEED_PORTLET_CLASSNAME); //if the user who commented this post is not the user who posted it notify the poster user (Post owner) - if (! user.getUsername().equals(postOwnerId)) { + if (! user.getUsername().equals(postOwnerId)) { boolean resultNotifyOwnComment = nm.notifyOwnCommentReply(postOwnerId, postId, escapedCommentText, theComment.getKey()); logger.info("Comment Notification to post owner added? " + resultNotifyOwnComment); } @@ -569,10 +569,10 @@ public class SocialUtils { likesThread.start(); //notify the other users who commented this post (excluding the ones above) -// Thread commentsNotificationthread = new Thread(new CommentNotificationsThread( -// CassandraConnection.getInstance().getDatabookStore(), -// uManager, user.getUsername(), theComment.getFeedid(), escapedCommentText, nm, postOwnerId, theComment.getKey(), likes)); -// commentsNotificationthread.start(); + Thread commentsNotificationthread = new Thread(new CommentNotificationsThread( + CassandraConnection.getInstance().getDatabookStore(), + uManager, user.getUsername(), theComment.getFeedid(), escapedCommentText, nm, postOwnerId, theComment.getKey(), likes)); + commentsNotificationthread.start(); //send the notification to the mentioned users, if any if (mentionedUsers != null && mentionedUsers.size() > 0) {