From b1fb7f966923d6036efb2a6824acc4d8edefe9c5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 3 Aug 2016 11:54:23 +0200 Subject: [PATCH] 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../beans/user/JobsUserWebSessionBean.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java index 124b9ea2..65cbfbbf 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java @@ -160,6 +160,9 @@ public class JobsUserWebSessionBean extends BaseJobsController implements JobsUs /** * 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; @@ -362,15 +365,17 @@ public class JobsUserWebSessionBean extends BaseJobsController implements JobsUs 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 -- 2.39.5