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
This commit is contained in:
Massimiliano Assante 2018-03-16 10:36:44 +00:00
parent 941c6f4961
commit 9011d7142d
3 changed files with 18 additions and 16 deletions

View File

@ -1400,7 +1400,7 @@ public class NewsFeedPanel extends Composite {
Window.alert("Could not deliver this comment. Please try again in a short while."); Window.alert("Could not deliver this comment. Please try again in a short while.");
} }
else { else {
Comment comment = (Comment) result.getObject(); Comment comment = (Comment) result.getComment();
owner.addComment(new SingleComment(comment, owner, (comment.getUserid().equals(myUserInfo.getUsername())))); owner.addComment(new SingleComment(comment, owner, (comment.getUserid().equals(myUserInfo.getUsername()))));
owner.setCommentingDisabled(false); owner.setCommentingDisabled(false);
owner.updateCommentsNumberCount(); owner.updateCommentsNumberCount();
@ -1437,7 +1437,7 @@ public class NewsFeedPanel extends Composite {
//CheckSession.showLogoutDialog(); //CheckSession.showLogoutDialog();
} }
else { else {
Comment comment = (Comment) result.getObject(); Comment comment = (Comment) result.getComment();
owner.updateSingleComment(comment, commentPanel); owner.updateSingleComment(comment, commentPanel);
owner.setCommentingDisabled(false); owner.setCommentingDisabled(false);
} }

View File

@ -1037,7 +1037,8 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
else { else {
PortalContext pContext = PortalContext.getConfiguration(); PortalContext pContext = PortalContext.getConfiguration();
String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername(); String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername();
ArrayList<ItemBean> allUsers = Utils.getDisplayableItemBeans("/"+PortalContext.getConfiguration().getInfrastructureName(), userName, isWithinPortal()); String context = pContext.getCurrentScope(getThreadLocalRequest());
ArrayList<ItemBean> allUsers = Utils.getDisplayableItemBeans(context, userName, isWithinPortal());
ArrayList<ItemBean> toReturn = new ArrayList<ItemBean>(); ArrayList<ItemBean> toReturn = new ArrayList<ItemBean>();
for (String fullName : fullNames) for (String fullName : fullNames)
for (ItemBean puser : allUsers) { for (ItemBean puser : allUsers) {
@ -1049,6 +1050,8 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
return toReturn; return toReturn;
} }
} }
/** /**
* tell if the user is a portal administrator or not * tell if the user is a portal administrator or not
* @param username * @param username

View File

@ -1,23 +1,24 @@
package org.gcube.portlets.user.newsfeed.shared; package org.gcube.portlets.user.newsfeed.shared;
import java.io.Serializable; import org.gcube.portal.databook.shared.Comment;
@SuppressWarnings("serial") import com.google.gwt.user.client.rpc.IsSerializable;
public class OperationResult implements Serializable {
public class OperationResult implements IsSerializable {
private Boolean success; private Boolean success;
private String message; private String message;
private Serializable object; private Comment comment;
public OperationResult() { public OperationResult() {
super(); super();
} }
public OperationResult(Boolean success, String message, Serializable object) { public OperationResult(Boolean success, String message, Comment comment) {
super(); super();
this.success = success; this.success = success;
this.message = message; this.message = message;
this.object = object; this.comment = comment;
} }
public Boolean isSuccess() { public Boolean isSuccess() {
@ -36,13 +37,11 @@ public class OperationResult implements Serializable {
this.message = message; this.message = message;
} }
public Serializable getObject() { public Comment getComment() {
return object; return comment;
} }
public void setObject(Serializable object) { public void setComment(Comment comment) {
this.object = object; this.comment = comment;
} }
} }