File tree Expand file tree Collapse file tree 2 files changed +41
-3
lines changed
services/static-webserver/client/source/class/osparc/store Expand file tree Collapse file tree 2 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -115,8 +115,7 @@ qx.Class.define("osparc.store.Groups", {
115115 // reset group's group members
116116 group . setGroupMembers ( { } ) ;
117117 orgMembers . forEach ( orgMember => {
118- const userMember = new osparc . data . model . UserMember ( orgMember ) ;
119- this . __addToUsersCache ( userMember , groupId ) ;
118+ this . __addMemberToCache ( orgMember , groupId ) ;
120119 } ) ;
121120 }
122121 } ) ;
@@ -419,14 +418,16 @@ qx.Class.define("osparc.store.Groups", {
419418 delete this . getOrganizations ( ) [ groupId ] ;
420419 } ,
421420
422- __addToUsersCache : function ( userMember , orgId = null ) {
421+ __addMemberToCache : function ( orgMember , orgId = null ) {
422+ const userMember = new osparc . data . model . UserMember ( orgMember ) ;
423423 if ( orgId ) {
424424 const organization = this . getOrganization ( orgId ) ;
425425 if ( organization ) {
426426 organization . addGroupMember ( userMember ) ;
427427 }
428428 }
429429 this . getUsers ( ) [ userMember . getGroupId ( ) ] = userMember ;
430+ osparc . store . Users . getInstance ( ) . addUser ( orgMember ) ;
430431 } ,
431432
432433 __removeUserFromCache : function ( userId , orgId ) {
Original file line number Diff line number Diff line change 1+ /* ************************************************************************
2+
3+ osparc - the simcore frontend
4+
5+ https://osparc.io
6+
7+ Copyright:
8+ 2024 IT'IS Foundation, https://itis.swiss
9+
10+ License:
11+ MIT: https://opensource.org/licenses/MIT
12+
13+ Authors:
14+ * Odei Maiz (odeimaiz)
15+
16+ ************************************************************************ */
17+
18+ qx . Class . define ( "osparc.store.Users" , {
19+ extend : qx . core . Object ,
20+ type : "singleton" ,
21+
22+ construct : function ( ) {
23+ this . base ( arguments ) ;
24+
25+ this . usersCached = [ ] ;
26+ } ,
27+
28+ members : {
29+ addUser : function ( userData ) {
30+ const userFound = this . usersCached . find ( user => user . getGroupId ( ) === userData [ "groupId" ] ) ;
31+ if ( ! userFound ) {
32+ const user = new osparc . data . model . User ( userData ) ;
33+ this . usersCached . push ( user ) ;
34+ }
35+ } ,
36+ }
37+ } ) ;
You can’t perform that action at this time.
0 commit comments