From: Roland Häder Date: Wed, 3 Aug 2016 09:54:23 +0000 (+0200) Subject: Please cherry-pick and later rewrite: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=eb528060383dfda373729084bff5d3b2316c5fec;p=pizzaservice-war.git Please cherry-pick and later rewrite: - having the current user in his own visuble users list makes no sense - maybe make a new application-scoped controller which maintains such lists Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java index c3c2503c..c905475c 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java @@ -148,6 +148,9 @@ public class PizzaUserWebSessionBean extends BasePizzaController implements Pizz /** * A list of all public user profiles + *

+ * @TODO Hmm, makes that sense? Having visible user list in current + * (session-scoped) user's visible user list? */ private List visibleUserList; @@ -329,15 +332,17 @@ public class PizzaUserWebSessionBean extends BasePizzaController implements Pizz throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N } - // Copy all data to this bean - this.copyUser(event.getLoggedInUser()); + // "Cache" user instance + User loggedInUser = event.getLoggedInUser(); - // Re-initialize list - // @TODO This calls the EJB again, after a user logs in which can cause lots of calls on it. - this.visibleUserList = this.userBean.allMemberPublicVisibleUsers(); + // Copy all data to this bean + this.copyUser(loggedInUser); - // Trace message - //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterUserLogin: this.visibleUserList.size()={0} - EXIT!", this.visibleUserList.size())); //NOI18N + // Is the user visible? + if (Objects.equals(loggedInUser.getUserProfileMode(), ProfileMode.PUBLIC)) { + // Yes, then add user + this.visibleUserList.add(loggedInUser); + } } @Override