From 9011d7142d9c627012962d7ff01c7cb2ae0b5f61 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Fri, 16 Mar 2018 10:36:44 +0000 Subject: [PATCH] Tried to reduce comment latency when someone is mentioned in comment git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@165173 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../newsfeed/client/panels/NewsFeedPanel.java | 4 +-- .../user/newsfeed/server/NewsServiceImpl.java | 5 +++- .../user/newsfeed/shared/OperationResult.java | 25 +++++++++---------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java index 0db4500..ad8d9cc 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java @@ -1400,7 +1400,7 @@ public class NewsFeedPanel extends Composite { Window.alert("Could not deliver this comment. Please try again in a short while."); } else { - Comment comment = (Comment) result.getObject(); + Comment comment = (Comment) result.getComment(); owner.addComment(new SingleComment(comment, owner, (comment.getUserid().equals(myUserInfo.getUsername())))); owner.setCommentingDisabled(false); owner.updateCommentsNumberCount(); @@ -1437,7 +1437,7 @@ public class NewsFeedPanel extends Composite { //CheckSession.showLogoutDialog(); } else { - Comment comment = (Comment) result.getObject(); + Comment comment = (Comment) result.getComment(); owner.updateSingleComment(comment, commentPanel); owner.setCommentingDisabled(false); } 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 a5a81aa..6521495 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 @@ -1037,7 +1037,8 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService else { PortalContext pContext = PortalContext.getConfiguration(); String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername(); - ArrayList allUsers = Utils.getDisplayableItemBeans("/"+PortalContext.getConfiguration().getInfrastructureName(), userName, isWithinPortal()); + String context = pContext.getCurrentScope(getThreadLocalRequest()); + ArrayList allUsers = Utils.getDisplayableItemBeans(context, userName, isWithinPortal()); ArrayList toReturn = new ArrayList(); for (String fullName : fullNames) for (ItemBean puser : allUsers) { @@ -1049,6 +1050,8 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService return toReturn; } } + + /** * tell if the user is a portal administrator or not * @param username diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/shared/OperationResult.java b/src/main/java/org/gcube/portlets/user/newsfeed/shared/OperationResult.java index a3553d9..6a3b954 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/shared/OperationResult.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/shared/OperationResult.java @@ -1,23 +1,24 @@ package org.gcube.portlets.user.newsfeed.shared; -import java.io.Serializable; +import org.gcube.portal.databook.shared.Comment; -@SuppressWarnings("serial") -public class OperationResult implements Serializable { +import com.google.gwt.user.client.rpc.IsSerializable; + +public class OperationResult implements IsSerializable { private Boolean success; private String message; - private Serializable object; + private Comment comment; public OperationResult() { super(); } - public OperationResult(Boolean success, String message, Serializable object) { + public OperationResult(Boolean success, String message, Comment comment) { super(); this.success = success; this.message = message; - this.object = object; + this.comment = comment; } public Boolean isSuccess() { @@ -36,13 +37,11 @@ public class OperationResult implements Serializable { this.message = message; } - public Serializable getObject() { - return object; + public Comment getComment() { + return comment; } - public void setObject(Serializable object) { - this.object = object; - } - - + public void setComment(Comment comment) { + this.comment = comment; + } }