1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-14 01:01:31 +01:00

Fix noop notification service registration (#13131)

* Re-order the constructor dependencies to match between Noop and Default notification service

* Fix test file

* One more missed constructor
This commit is contained in:
Shane Melton 2025-01-29 09:58:01 -08:00 committed by GitHub
parent aef81210e3
commit db2b405421
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,6 @@
// FIXME: Update this file to be type safe and remove this and next line // FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore // @ts-strict-ignore
import { Subject, filter, firstValueFrom, map, merge, timeout } from "rxjs"; import { filter, firstValueFrom, map, merge, Subject, timeout } from "rxjs";
import { CollectionService, DefaultCollectionService } from "@bitwarden/admin-console/common"; import { CollectionService, DefaultCollectionService } from "@bitwarden/admin-console/common";
import { import {
@ -112,10 +112,10 @@ import { NotificationsService } from "@bitwarden/common/platform/notifications";
// eslint-disable-next-line no-restricted-imports -- Needed for service creation // eslint-disable-next-line no-restricted-imports -- Needed for service creation
import { import {
DefaultNotificationsService, DefaultNotificationsService,
WorkerWebPushConnectionService,
SignalRConnectionService, SignalRConnectionService,
UnsupportedWebPushConnectionService, UnsupportedWebPushConnectionService,
WebPushNotificationsApiService, WebPushNotificationsApiService,
WorkerWebPushConnectionService,
} from "@bitwarden/common/platform/notifications/internal"; } from "@bitwarden/common/platform/notifications/internal";
import { ScheduledTaskNames } from "@bitwarden/common/platform/scheduling"; import { ScheduledTaskNames } from "@bitwarden/common/platform/scheduling";
import { AppIdService } from "@bitwarden/common/platform/services/app-id.service"; import { AppIdService } from "@bitwarden/common/platform/services/app-id.service";
@ -198,10 +198,10 @@ import { FolderService } from "@bitwarden/common/vault/services/folder/folder.se
import { TotpService } from "@bitwarden/common/vault/services/totp.service"; import { TotpService } from "@bitwarden/common/vault/services/totp.service";
import { VaultSettingsService } from "@bitwarden/common/vault/services/vault-settings/vault-settings.service"; import { VaultSettingsService } from "@bitwarden/common/vault/services/vault-settings/vault-settings.service";
import { import {
PasswordGenerationServiceAbstraction,
UsernameGenerationServiceAbstraction,
legacyPasswordGenerationServiceFactory, legacyPasswordGenerationServiceFactory,
legacyUsernameGenerationServiceFactory, legacyUsernameGenerationServiceFactory,
PasswordGenerationServiceAbstraction,
UsernameGenerationServiceAbstraction,
} from "@bitwarden/generator-legacy"; } from "@bitwarden/generator-legacy";
import { import {
ImportApiService, ImportApiService,
@ -210,11 +210,11 @@ import {
ImportServiceAbstraction, ImportServiceAbstraction,
} from "@bitwarden/importer/core"; } from "@bitwarden/importer/core";
import { import {
BiometricStateService,
BiometricsService, BiometricsService,
BiometricStateService,
DefaultBiometricStateService, DefaultBiometricStateService,
DefaultKeyService,
DefaultKdfConfigService, DefaultKdfConfigService,
DefaultKeyService,
KdfConfigService, KdfConfigService,
KeyService as KeyServiceAbstraction, KeyService as KeyServiceAbstraction,
} from "@bitwarden/key-management"; } from "@bitwarden/key-management";
@ -1057,6 +1057,7 @@ export default class MainBackground {
} }
this.notificationsService = new DefaultNotificationsService( this.notificationsService = new DefaultNotificationsService(
this.logService,
this.syncService, this.syncService,
this.appIdService, this.appIdService,
this.environmentService, this.environmentService,
@ -1066,7 +1067,6 @@ export default class MainBackground {
new SignalRConnectionService(this.apiService, this.logService), new SignalRConnectionService(this.apiService, this.logService),
this.authService, this.authService,
this.webPushConnectionService, this.webPushConnectionService,
this.logService,
); );
this.fido2UserInterfaceService = new BrowserFido2UserInterfaceService(this.authService); this.fido2UserInterfaceService = new BrowserFido2UserInterfaceService(this.authService);

View File

@ -906,6 +906,7 @@ const safeProviders: SafeProvider[] = [
? NoopNotificationsService ? NoopNotificationsService
: DefaultNotificationsService, : DefaultNotificationsService,
deps: [ deps: [
LogService,
SyncService, SyncService,
AppIdServiceAbstraction, AppIdServiceAbstraction,
EnvironmentService, EnvironmentService,
@ -915,7 +916,6 @@ const safeProviders: SafeProvider[] = [
SignalRConnectionService, SignalRConnectionService,
AuthServiceAbstraction, AuthServiceAbstraction,
WebPushConnectionService, WebPushConnectionService,
LogService,
], ],
}), }),
safeProvider({ safeProvider({

View File

@ -22,7 +22,7 @@ import {
DefaultNotificationsService, DefaultNotificationsService,
DISABLED_NOTIFICATIONS_URL, DISABLED_NOTIFICATIONS_URL,
} from "./default-notifications.service"; } from "./default-notifications.service";
import { SignalRNotification, SignalRConnectionService } from "./signalr-connection.service"; import { SignalRConnectionService, SignalRNotification } from "./signalr-connection.service";
import { WebPushConnectionService, WebPushConnector } from "./webpush-connection.service"; import { WebPushConnectionService, WebPushConnector } from "./webpush-connection.service";
import { WorkerWebPushConnectionService } from "./worker-webpush-connection.service"; import { WorkerWebPushConnectionService } from "./worker-webpush-connection.service";
@ -92,6 +92,7 @@ describe("NotificationsService", () => {
); );
sut = new DefaultNotificationsService( sut = new DefaultNotificationsService(
mock<LogService>(),
syncService, syncService,
appIdService, appIdService,
environmentService, environmentService,
@ -101,7 +102,6 @@ describe("NotificationsService", () => {
signalRNotificationConnectionService, signalRNotificationConnectionService,
authService, authService,
webPushNotificationConnectionService, webPushNotificationConnectionService,
mock<LogService>(),
); );
}); });

View File

@ -42,6 +42,7 @@ export class DefaultNotificationsService implements NotificationsServiceAbstract
private activitySubject = new BehaviorSubject<"active" | "inactive">("active"); private activitySubject = new BehaviorSubject<"active" | "inactive">("active");
constructor( constructor(
private readonly logService: LogService,
private syncService: SyncService, private syncService: SyncService,
private appIdService: AppIdService, private appIdService: AppIdService,
private environmentService: EnvironmentService, private environmentService: EnvironmentService,
@ -51,7 +52,6 @@ export class DefaultNotificationsService implements NotificationsServiceAbstract
private readonly signalRConnectionService: SignalRConnectionService, private readonly signalRConnectionService: SignalRConnectionService,
private readonly authService: AuthService, private readonly authService: AuthService,
private readonly webPushConnectionService: WebPushConnectionService, private readonly webPushConnectionService: WebPushConnectionService,
private readonly logService: LogService,
) { ) {
this.notifications$ = this.accountService.activeAccount$.pipe( this.notifications$ = this.accountService.activeAccount$.pipe(
map((account) => account?.id), map((account) => account?.id),