1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 01:03:35 +00:00

[PM-21041] Fix cipher view security tasks fetching (#14569)

* [PM-21041] Add taskEnabled$ dependency to tasks$ observable

* [PM-21041] Rework cipher view component to only check tasks for organization Login type ciphers

- Remove dependency on feature flag check (handled by tasks$ observable now)
- Add try/catch in case of request failures to avoid breaking component initialization

* [PM-21041] Remove now redundant taskEnabled$ chain

* [PM-21041] Fix tests
This commit is contained in:
Shane Melton
2025-05-01 11:22:32 -07:00
committed by GitHub
parent de6b58c10a
commit cba5f826d6
6 changed files with 147 additions and 73 deletions

View File

@@ -1,7 +1,7 @@
import { CommonModule } from "@angular/common";
import { Component, inject } from "@angular/core";
import { RouterModule } from "@angular/router";
import { map, of, switchMap } from "rxjs";
import { map, switchMap } from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { getUserId } from "@bitwarden/common/auth/services/account.service";
@@ -20,21 +20,7 @@ export class AtRiskPasswordCalloutComponent {
private activeAccount$ = inject(AccountService).activeAccount$.pipe(getUserId);
protected pendingTasks$ = this.activeAccount$.pipe(
switchMap((userId) =>
this.taskService.tasksEnabled$(userId).pipe(
switchMap((enabled) => {
if (!enabled) {
return of([]);
}
return this.taskService
.pendingTasks$(userId)
.pipe(
map((tasks) =>
tasks.filter((t) => t.type === SecurityTaskType.UpdateAtRiskCredential),
),
);
}),
),
),
switchMap((userId) => this.taskService.pendingTasks$(userId)),
map((tasks) => tasks.filter((t) => t.type === SecurityTaskType.UpdateAtRiskCredential)),
);
}