From bf808987cb34d714d273d0b5b6d0ca03d670affc Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Fri, 16 Oct 2015 10:27:47 +0000 Subject: [PATCH] fix for Bug #1033 git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@119826 82a268e6-3cf1-43bd-a215-b396298e98cf --- .settings/org.eclipse.wst.common.component | 3 --- .../gcube/portlets/user/newsfeed/server/NewsServiceImpl.java | 4 ++-- .../java/org/gcube/portlets/user/newsfeed/server/Utils.java | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 3f8ea4e..f233636 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -4,9 +4,6 @@ - - uses - uses diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java b/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java index 726cd23..4308d86 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java @@ -642,7 +642,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService //if the user who commented this post is not the user who posted it notify the poster user (Feed owner) NotificationsManager nm = new ApplicationNotificationsManager(getASLSession(), APP_ID); if (! user.getUsername().equals(feedOwnerId) && (!isAppFeed)) { - boolean result = nm.notifyOwnCommentReply(feedOwnerId, feedid, escapeHtml(commentText)); + boolean result = nm.notifyOwnCommentReply(feedOwnerId, feedid, escapedCommentText); _log.trace("Comment Notification to post owner added? " + result); } @@ -652,7 +652,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService likesThread.start(); //notify the other users who commented this post (excluding the ones above) - Thread commentsNotificationthread = new Thread(new CommentNotificationsThread(store, user.getUsername(), comment.getFeedid(), commentText, nm, feedOwnerId, favorites)); + Thread commentsNotificationthread = new Thread(new CommentNotificationsThread(store, user.getUsername(), comment.getFeedid(), escapedCommentText, nm, feedOwnerId, favorites)); commentsNotificationthread.start(); //send the notification to the mentioned users, if any diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/server/Utils.java b/src/main/java/org/gcube/portlets/user/newsfeed/server/Utils.java index 5a532c2..27d93fa 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/server/Utils.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/server/Utils.java @@ -85,10 +85,10 @@ public class Utils { */ protected static List getHashTags(String postText) { List hashtags = new ArrayList<>(); - Pattern MY_PATTERN = Pattern.compile("#(\\w+)"); + Pattern MY_PATTERN = Pattern.compile("^#\\w+|\\s#\\w+"); Matcher matcher = MY_PATTERN.matcher(postText); while (matcher.find()) { - hashtags.add("#"+matcher.group(1)); + hashtags.add("#"+matcher.group().replace(" ", "").replace("#", "")); } return hashtags; }