found the bug

This commit is contained in:
Massimiliano Assante 2023-02-08 16:21:17 +01:00
parent 5af56a039a
commit 09ca845311
2 changed files with 7 additions and 7 deletions

View File

@ -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());

View File

@ -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) {