diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-07-23 22:24:23 +0530 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-07-23 22:24:23 +0530 |
commit | 9d3308dd8fbcbbd854c66a3e53ca4ba66853dd30 (patch) | |
tree | 92e6defd4c4efd734f39f684800240a52ab21b34 /src | |
parent | a22f9b3c98c11d1170d1b0548bab61fc73fbc44f (diff) |
groups bugfix
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/GroupManager.tsx | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/client/util/GroupManager.tsx b/src/client/util/GroupManager.tsx index a679c9087..7d02b1e66 100644 --- a/src/client/util/GroupManager.tsx +++ b/src/client/util/GroupManager.tsx @@ -48,14 +48,6 @@ export default class GroupManager extends React.Component<{}> { componentDidMount() { this.populateUsers(); - DocListCastAsync(this.GroupManagerDoc?.data).then(groups => { - groups?.forEach(group => { - const members: string[] = JSON.parse(StrCast(group.members)); - if (members.includes(Doc.CurrentUserEmail)) this.currentUserGroups.push(StrCast(group.groupName)); - }); - - setGroups(this.currentUserGroups); - }); } /** @@ -82,6 +74,17 @@ export default class GroupManager extends React.Component<{}> { return Promise.all(evaluating); } + populateGroups = () => { + DocListCastAsync(this.GroupManagerDoc?.data).then(groups => { + groups?.forEach(group => { + const members: string[] = JSON.parse(StrCast(group.members)); + if (members.includes(Doc.CurrentUserEmail)) this.currentUserGroups.push(StrCast(group.groupName)); + }); + + setGroups(this.currentUserGroups); + }); + } + /** * @returns the options to be rendered in the dropdown menu to add users and create a group. */ @@ -97,14 +100,7 @@ export default class GroupManager extends React.Component<{}> { SelectionManager.DeselectAll(); this.isOpen = true; this.populateUsers(); - DocListCastAsync(this.GroupManagerDoc?.data).then(groups => { - groups?.forEach(group => { - const members: string[] = JSON.parse(StrCast(group.members)); - if (members.includes(Doc.CurrentUserEmail)) this.currentUserGroups.push(StrCast(group.groupName)); - }); - - setGroups(this.currentUserGroups); - }); + this.populateGroups(); } /** |