1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[PM-17563] Security task background synchronization (#14086)

* [PM-17563] Implement listenForTaskNotifications in default-task.service.ts

* [PM-17563] Update syncService to include userId in syncCompleted message payload

* [PM-17563] Update default-task.service to react to both pending task notifications and completed syncs

* [PM-17563] Add unit tests around task notification listening

* [PM-17563] Only check for at risk password tasks if tasks are enabled

* [PM-17563] Make userId required even if undefined

* [PM-17563] Use abstract TaskService instead of default implementation in MainBackground

* [PM-17563] Cleanup userId filtering
This commit is contained in:
Shane Melton
2025-04-04 13:42:44 -07:00
committed by GitHub
parent 1af8fe2012
commit a7fe4877d7
9 changed files with 400 additions and 39 deletions

View File

@@ -3,9 +3,9 @@
import { firstValueFrom, map } from "rxjs";
import {
CollectionService,
CollectionData,
CollectionDetailsResponse,
CollectionService,
} from "@bitwarden/admin-console/common";
import { KeyService } from "@bitwarden/key-management";
@@ -107,7 +107,7 @@ export class DefaultSyncService extends CoreSyncService {
this.syncStarted();
const authStatus = await firstValueFrom(this.authService.authStatusFor$(userId));
if (authStatus === AuthenticationStatus.LoggedOut) {
return this.syncCompleted(false);
return this.syncCompleted(false, userId);
}
const now = new Date();
@@ -116,14 +116,14 @@ export class DefaultSyncService extends CoreSyncService {
needsSync = await this.needsSyncing(forceSync);
} catch (e) {
if (allowThrowOnError) {
this.syncCompleted(false);
this.syncCompleted(false, userId);
throw e;
}
}
if (!needsSync) {
await this.setLastSync(now, userId);
return this.syncCompleted(false);
return this.syncCompleted(false, userId);
}
try {
@@ -139,13 +139,13 @@ export class DefaultSyncService extends CoreSyncService {
await this.syncPolicies(response.policies, response.profile.id);
await this.setLastSync(now, userId);
return this.syncCompleted(true);
return this.syncCompleted(true, userId);
} catch (e) {
if (allowThrowOnError) {
this.syncCompleted(false);
this.syncCompleted(false, userId);
throw e;
} else {
return this.syncCompleted(false);
return this.syncCompleted(false, userId);
}
}
}