From d026087bfdbc78e63e3624149947c64c6f297759 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Fri, 12 Apr 2024 21:57:17 +1000 Subject: [PATCH] [AC-2443] Update unassigned items banner text for self-hosted (#8719) * Update banner text for self-hosted environments * Fix tests * Fix web vault wording * Actually fix web vault wording --- apps/browser/src/_locales/en/messages.json | 3 +++ .../components/vault/current-tab.component.html | 5 +++-- .../app/layouts/header/web-header.component.html | 6 ++++-- apps/web/src/locales/en/messages.json | 3 +++ .../unassigned-items-banner.service.spec.ts | 9 +++++++-- .../services/unassigned-items-banner.service.ts | 15 ++++++++++++++- 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json index 9d444ce40ef..4108db39961 100644 --- a/apps/browser/src/_locales/en/messages.json +++ b/apps/browser/src/_locales/en/messages.json @@ -3008,5 +3008,8 @@ }, "unassignedItemsBanner": { "message": "Notice: Unassigned organization items are no longer visible in the All Vaults view and only accessible via the Admin Console. Assign these items to a collection from the Admin Console to make them visible." + }, + "unassignedItemsBannerSelfHost": { + "message": "Notice: On May 2, 2024, unassigned organization items will no longer be visible in the All Vaults view and will only be accessible via the Admin Console. Assign these items to a collection from the Admin Console to make them visible." } } diff --git a/apps/browser/src/vault/popup/components/vault/current-tab.component.html b/apps/browser/src/vault/popup/components/vault/current-tab.component.html index 1a42f707010..fc8b4212bac 100644 --- a/apps/browser/src/vault/popup/components/vault/current-tab.component.html +++ b/apps/browser/src/vault/popup/components/vault/current-tab.component.html @@ -39,12 +39,13 @@

- {{ "unassignedItemsBanner" | i18n }} + {{ unassignedItemsBannerService.bannerText$ | async | i18n }} - {{ "unassignedItemsBanner" | i18n }} + {{ unassignedItemsBannerService.bannerText$ | async | i18n }} { let stateProvider: FakeStateProvider; let apiService: MockProxy; + let environmentService: MockProxy; - const sutFactory = () => new UnassignedItemsBannerService(stateProvider, apiService); + const sutFactory = () => + new UnassignedItemsBannerService(stateProvider, apiService, environmentService); beforeEach(() => { const fakeAccountService = mockAccountServiceWith("userId" as UserId); stateProvider = new FakeStateProvider(fakeAccountService); apiService = mock(); + environmentService = mock(); + environmentService.environment$ = of(null); }); it("shows the banner if showBanner local state is true", async () => { diff --git a/libs/angular/src/services/unassigned-items-banner.service.ts b/libs/angular/src/services/unassigned-items-banner.service.ts index faa766a18a8..13a745fb82f 100644 --- a/libs/angular/src/services/unassigned-items-banner.service.ts +++ b/libs/angular/src/services/unassigned-items-banner.service.ts @@ -1,6 +1,10 @@ import { Injectable } from "@angular/core"; -import { concatMap } from "rxjs"; +import { concatMap, map } from "rxjs"; +import { + EnvironmentService, + Region, +} from "@bitwarden/common/platform/abstractions/environment.service"; import { StateProvider, UNASSIGNED_ITEMS_BANNER_DISK, @@ -36,9 +40,18 @@ export class UnassignedItemsBannerService { }), ); + bannerText$ = this.environmentService.environment$.pipe( + map((e) => + e?.getRegion() == Region.SelfHosted + ? "unassignedItemsBannerSelfHost" + : "unassignedItemsBanner", + ), + ); + constructor( private stateProvider: StateProvider, private apiService: UnassignedItemsBannerApiService, + private environmentService: EnvironmentService, ) {} async hideBanner() {