mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-27688] fix events page not loading (#17166)
* remove unneeded rxjs filter * add check for canManage * add null check * fix provider ID, clean up
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// @ts-strict-ignore
|
||||
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { concatMap, firstValueFrom, lastValueFrom, map, switchMap, takeUntil } from "rxjs";
|
||||
import { concatMap, firstValueFrom, lastValueFrom, map, of, switchMap, takeUntil, tap } from "rxjs";
|
||||
|
||||
import { OrganizationUserApiService } from "@bitwarden/admin-console/common";
|
||||
import { UserNamePipe } from "@bitwarden/angular/pipes/user-name.pipe";
|
||||
@@ -143,16 +143,23 @@ export class EventsComponent extends BaseEventsComponent implements OnInit, OnDe
|
||||
getUserId,
|
||||
switchMap((userId) => this.providerService.get$(this.organization.providerId, userId)),
|
||||
map((provider) => provider != null && provider.canManageUsers),
|
||||
switchMap(() => this.apiService.getProviderUsers(this.organization.id)),
|
||||
map((providerUsersResponse) =>
|
||||
providerUsersResponse.data.forEach((u) => {
|
||||
const name = this.userNamePipe.transform(u);
|
||||
this.orgUsersUserIdMap.set(u.userId, {
|
||||
name: `${name} (${this.organization.providerName})`,
|
||||
email: u.email,
|
||||
switchMap((canManage) => {
|
||||
if (canManage) {
|
||||
return this.apiService.getProviderUsers(this.organization.providerId);
|
||||
}
|
||||
return of(null);
|
||||
}),
|
||||
tap((providerUsersResponse) => {
|
||||
if (providerUsersResponse) {
|
||||
providerUsersResponse.data.forEach((u) => {
|
||||
const name = this.userNamePipe.transform(u);
|
||||
this.orgUsersUserIdMap.set(u.userId, {
|
||||
name: `${name} (${this.organization.providerName})`,
|
||||
email: u.email,
|
||||
});
|
||||
});
|
||||
}),
|
||||
),
|
||||
}
|
||||
}),
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user