Skip to content

Commit

Permalink
[PM-14421] Fix organization service usage after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
shane-melton committed Jan 24, 2025
1 parent 83068cc commit 82be88a
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { Router } from "@angular/router";
import { combineLatest, map, of, shareReplay, startWith, switchMap } from "rxjs";

import { JslibModule } from "@bitwarden/angular/jslib.module";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import {
getOrganizationById,
OrganizationService,
} from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
Expand Down Expand Up @@ -58,11 +61,13 @@ export class AtRiskPasswordsComponent {
filterOutNullish(),
map((ciphers) => Object.fromEntries(ciphers.map((c) => [c.id, c]))),
),
of(user),
]),
),
map(([tasks, ciphers]) => ({
map(([tasks, ciphers, user]) => ({
tasks,
ciphers,
userId: user.id,
})),
shareReplay({ bufferSize: 1, refCount: true }),
);
Expand All @@ -86,17 +91,14 @@ export class AtRiskPasswordsComponent {
);

protected pageDescription$ = this.activeUserData$.pipe(
switchMap(({ tasks }) => {
switchMap(({ tasks, userId }) => {
const orgIds = new Set(tasks.map((t) => t.organizationId));
if (orgIds.size === 1) {
const [orgId] = orgIds;
return this.organizationService
.get$(orgId)
.pipe(
map((org) =>
this.i18nService.t("atRiskPasswordsDescSingleOrg", org?.name, tasks.length),
),
);
return this.organizationService.organizations$(userId).pipe(

Check failure on line 98 in apps/browser/src/vault/popup/components/at-risk-passwords/at-risk-passwords.component.ts

View workflow job for this annotation

GitHub Actions / Test Results

AtRiskPasswordsComponent ► AtRiskPasswordsComponent pageDescription$ should use single org description when tasks belong to one org ► AtRiskPasswordsComponent pageDescription$ should use single org description when tasks belong to one org

Failed test found in: junit.xml Error: TypeError: this.organizationService.organizations$ is not a function
Raw output
TypeError: this.organizationService.organizations$ is not a function
    at organizations$ (/home/runner/work/clients/clients/apps/browser/src/vault/popup/components/at-risk-passwords/at-risk-passwords.component.ts:98:41)
    at /home/runner/work/clients/clients/node_modules/rxjs/src/internal/operators/switchMap.ts:109:21
    at OperatorSubscriber._this._next (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts:70:13)
    at OperatorSubscriber.Object.<anonymous>.Subscriber.next (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/Subscriber.ts:75:12)
    at ReplaySubject.Object.<anonymous>.ReplaySubject._subscribe (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/ReplaySubject.ts:80:18)
    at ReplaySubject.Object.<anonymous>.Observable._trySubscribe (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/Observable.ts:244:19)
    at ReplaySubject.Object.<anonymous>.Subject._trySubscribe (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/Subject.ts:113:31)
    at /home/runner/work/clients/clients/node_modules/rxjs/src/internal/Observable.ts:234:18
    at Object.errorContext (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/util/errorContext.ts:29:5)
    at ReplaySubject.Object.<anonymous>.Observable.subscribe (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/Observable.ts:220:5)
    at /home/runner/work/clients/clients/node_modules/rxjs/src/internal/operators/share.ts:210:12
    at OperatorSubscriber.<anonymous> (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/util/lift.ts:24:18)
    at /home/runner/work/clients/clients/node_modules/rxjs/src/internal/Observable.ts:226:22
    at Object.errorContext (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/util/errorContext.ts:29:5)
    at Observable.Object.<anonymous>.Observable.subscribe (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/Observable.ts:220:5)
    at /home/runner/work/clients/clients/node_modules/rxjs/src/internal/operators/switchMap.ts:100:12
    at SafeSubscriber.<anonymous> (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/util/lift.ts:24:18)
    at /home/runner/work/clients/clients/node_modules/rxjs/src/internal/Observable.ts:226:22
    at Object.errorContext (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/util/errorContext.ts:29:5)
    at Observable.Object.<anonymous>.Observable.subscribe (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/Observable.ts:220:5)
    at /home/runner/work/clients/clients/node_modules/rxjs/src/internal/firstValueFrom.ts:73:12
    at new ZoneAwarePromise (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:2623:29)
    at firstValueFrom (/home/runner/work/clients/clients/node_modules/rxjs/src/internal/firstValueFrom.ts:58:10)
    at /home/runner/work/clients/clients/apps/browser/src/vault/popup/components/at-risk-passwords/at-risk-passwords.component.spec.ts:155:47
    at Generator.next (<anonymous>)
    at /home/runner/work/clients/clients/apps/browser/src/vault/popup/components/at-risk-passwords/at-risk-passwords.component.spec.ts:14:71
    at new ZoneAwarePromise (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:2623:29)
    at Object.<anonymous>.__awaiter (/home/runner/work/clients/clients/apps/browser/src/vault/popup/components/at-risk-passwords/at-risk-passwords.component.spec.ts:10:12)
    at /home/runner/work/clients/clients/apps/browser/src/vault/popup/components/at-risk-passwords/at-risk-passwords.component.spec.ts:154:85
    at _ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:416:32)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:2176:43)
    at _ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:415:38)
    at ZoneImpl.run (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:147:47)
    at Object.wrappedFunc (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:450:38)
    at Promise.then.completed (/home/runner/work/clients/clients/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/home/runner/work/clients/clients/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (/home/runner/work/clients/clients/node_modules/jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at _runTest (/home/runner/work/clients/clients/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (/home/runner/work/clients/clients/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (/home/runner/work/clients/clients/node_modules/jest-circus/build/run.js:121:9)
    at _runTestsForDescribeBlock (/home/runner/work/clients/clients/node_modules/jest-circus/build/run.js:121:9)
    at run (/home/runner/work/clients/clients/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (/home/runner/work/clients/clients/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
getOrganizationById(orgId),
map((org) => this.i18nService.t("atRiskPasswordsDescSingleOrg", org?.name, tasks.length)),
);
}

return of(this.i18nService.t("atRiskPasswordsDescMultiOrg", tasks.length));
Expand Down

0 comments on commit 82be88a

Please sign in to comment.