From 0812f00d24799d2c25c4ca86d73985841e88b946 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Wed, 15 May 2024 10:59:59 +1000 Subject: [PATCH] Fix groups modal not loading if admin access restricted (#9182) --- .../organizations/manage/group-add-edit.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts b/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts index 52cba4f2ae..dff549ba6e 100644 --- a/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts +++ b/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts @@ -273,12 +273,13 @@ export class GroupAddEditComponent implements OnInit, OnDestroy { // If the current user is not already in the group and cannot add themselves, remove them from the list if (restrictGroupAccess) { - const organizationUserId = this.members.find((m) => m.userId === activeAccount.id).id; + // organizationUserId may be null if accessing via a provider + const organizationUserId = this.members.find((m) => m.userId === activeAccount.id)?.id; const isAlreadyInGroup = this.groupForm.value.members.some( (m) => m.id === organizationUserId, ); - if (!isAlreadyInGroup) { + if (organizationUserId != null && !isAlreadyInGroup) { this.members = this.members.filter((m) => m.id !== organizationUserId); } }