Social Post parsing switched to new solution refs #13207

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@176762 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2019-01-23 16:06:35 +00:00
parent cc82741927
commit 66312747fb
2 changed files with 29 additions and 2 deletions

View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>share-updates</artifactId> <artifactId>share-updates</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>2.6.2-SNAPSHOT</version> <version>2.6.3-SNAPSHOT</version>
<name>gCube Share Updates Portlet</name> <name>gCube Share Updates Portlet</name>
<description> <description>
gCube Share Updates for exchanging updates with other users of VREs. gCube Share Updates for exchanging updates with other users of VREs.

View File

@ -55,6 +55,7 @@ import org.gcube.portlets.user.shareupdates.shared.MentionedDTO;
import org.gcube.portlets.user.shareupdates.shared.UploadedFile; import org.gcube.portlets.user.shareupdates.shared.UploadedFile;
import org.gcube.portlets.user.shareupdates.shared.UserSettings; import org.gcube.portlets.user.shareupdates.shared.UserSettings;
import org.gcube.portlets.widgets.pickitem.shared.ItemBean; import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
import org.gcube.social_networking.socialutillibrary.MessageParser;
import org.gcube.social_networking.socialutillibrary.Utils; import org.gcube.social_networking.socialutillibrary.Utils;
import org.gcube.vomanagement.usermanagement.GroupManager; import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.RoleManager; import org.gcube.vomanagement.usermanagement.RoleManager;
@ -126,6 +127,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
public ClientFeed sharePostWithLinkPreview(String postText, FeedType feedType, PrivacyLevel pLevel, public ClientFeed sharePostWithLinkPreview(String postText, FeedType feedType, PrivacyLevel pLevel,
Long vreOrgId, LinkPreview preview, String urlThumbnail, ArrayList<MentionedDTO> mentionedItems, boolean notifyGroup) { Long vreOrgId, LinkPreview preview, String urlThumbnail, ArrayList<MentionedDTO> mentionedItems, boolean notifyGroup) {
/*
// escape text // escape text
String escapedFeedText = Utils.escapeHtmlAndTransformUrl(postText); String escapedFeedText = Utils.escapeHtmlAndTransformUrl(postText);
@ -140,6 +142,17 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
mentionedUsers = getMentionsBean(mentionedItems); mentionedUsers = getMentionsBean(mentionedItems);
escapedFeedText = Utils.convertMentionPeopleAnchorHTML(escapedFeedText, mentionedUsers, getThreadLocalRequest()); escapedFeedText = Utils.convertMentionPeopleAnchorHTML(escapedFeedText, mentionedUsers, getThreadLocalRequest());
} }
*/
ArrayList<ItemBean> mentionedUsers = null;
if (mentionedItems != null && ! mentionedItems.isEmpty()) {
mentionedUsers = getMentionsBean(mentionedItems);
}
MessageParser messageParser = new MessageParser(postText);
String siteLandingPagePath = PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest());
String escapedFeedText = messageParser.getParsedMessage(mentionedUsers, siteLandingPagePath);
List<String> hashtags = messageParser.getHashtags();
PortalContext context = PortalContext.getConfiguration(); PortalContext context = PortalContext.getConfiguration();
GCubeUser currUser = context.getCurrentUser(getThreadLocalRequest()); GCubeUser currUser = context.getCurrentUser(getThreadLocalRequest());
@ -236,6 +249,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
PrivacyLevel pLevel, Long vreOrgId, ArrayList<UploadedFile> uploadedFiles, PrivacyLevel pLevel, Long vreOrgId, ArrayList<UploadedFile> uploadedFiles,
ArrayList<MentionedDTO> mentionedItems, boolean notifyGroup, boolean saveCopyWokspace) { ArrayList<MentionedDTO> mentionedItems, boolean notifyGroup, boolean saveCopyWokspace) {
/*
// escape text // escape text
String escapedFeedText = Utils.escapeHtmlAndTransformUrl(feedText); String escapedFeedText = Utils.escapeHtmlAndTransformUrl(feedText);
@ -250,6 +264,19 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
mentionedUsers = getMentionsBean(mentionedItems); mentionedUsers = getMentionsBean(mentionedItems);
escapedFeedText = Utils.convertMentionPeopleAnchorHTML(escapedFeedText, mentionedUsers, getThreadLocalRequest()); escapedFeedText = Utils.convertMentionPeopleAnchorHTML(escapedFeedText, mentionedUsers, getThreadLocalRequest());
} }
*/
ArrayList<ItemBean> mentionedUsers = null;
if (mentionedItems != null && ! mentionedItems.isEmpty()) {
mentionedUsers = getMentionsBean(mentionedItems);
}
MessageParser messageParser = new MessageParser(feedText);
String siteLandingPagePath = PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest());
String escapedFeedText = messageParser.getParsedMessage(mentionedUsers, siteLandingPagePath);
List<String> hashtags = messageParser.getHashtags();
PortalContext context = PortalContext.getConfiguration(); PortalContext context = PortalContext.getConfiguration();
GCubeUser currUser = context.getCurrentUser(getThreadLocalRequest()); GCubeUser currUser = context.getCurrentUser(getThreadLocalRequest());