]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Please cherry-pick and later rewrite:
authorRoland Häder <roland@mxchange.org>
Wed, 3 Aug 2016 09:54:23 +0000 (11:54 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 6 Aug 2016 21:27:20 +0000 (23:27 +0200)
- 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 <roland@mxchange.org>
src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java

index 29b088ad88a407f452eef376796a60b9fc8eb3f3..7a380cfa8d42d34ac06b0bc432cfc0b30d997106 100644 (file)
@@ -148,6 +148,9 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp
 
        /**
         * A list of all public user profiles
+        * <p>
+        * @TODO Hmm, makes that sense? Having visible user list in current
+        * (session-scoped) user's visible user list?
         */
        private List<User> visibleUserList;
 
@@ -329,14 +332,17 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp
                        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
+               // Is the user visible?
+               if (Objects.equals(loggedInUser.getUserProfileMode(), ProfileMode.PUBLIC)) {
+                       // Yes, then add user
+                       this.visibleUserList.add(loggedInUser);
+               }
        }
 
        @Override