mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 00:03:56 +00:00
[PM-5499] auth request service migrations (#8597)
* move auth request storage to service * create migrations for auth requests * fix tests * fix browser * fix login strategy * update migration * use correct test descriptions in migration
This commit is contained in:
@@ -2,6 +2,7 @@ import * as signalR from "@microsoft/signalr";
|
||||
import * as signalRMsgPack from "@microsoft/signalr-protocol-msgpack";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import { AuthRequestServiceAbstraction } from "../../../auth/src/common/abstractions";
|
||||
import { ApiService } from "../abstractions/api.service";
|
||||
import { NotificationsService as NotificationsServiceAbstraction } from "../abstractions/notifications.service";
|
||||
import { AuthService } from "../auth/abstractions/auth.service";
|
||||
@@ -18,6 +19,7 @@ import { EnvironmentService } from "../platform/abstractions/environment.service
|
||||
import { LogService } from "../platform/abstractions/log.service";
|
||||
import { MessagingService } from "../platform/abstractions/messaging.service";
|
||||
import { StateService } from "../platform/abstractions/state.service";
|
||||
import { UserId } from "../types/guid";
|
||||
import { SyncService } from "../vault/abstractions/sync/sync.service.abstraction";
|
||||
|
||||
export class NotificationsService implements NotificationsServiceAbstraction {
|
||||
@@ -37,6 +39,7 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
||||
private logoutCallback: (expired: boolean) => Promise<void>,
|
||||
private stateService: StateService,
|
||||
private authService: AuthService,
|
||||
private authRequestService: AuthRequestServiceAbstraction,
|
||||
private messagingService: MessagingService,
|
||||
) {
|
||||
this.environmentService.environment$.subscribe(() => {
|
||||
@@ -199,10 +202,13 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
||||
await this.syncService.syncDeleteSend(notification.payload as SyncSendNotification);
|
||||
break;
|
||||
case NotificationType.AuthRequest:
|
||||
if (await this.stateService.getApproveLoginRequests()) {
|
||||
this.messagingService.send("openLoginApproval", {
|
||||
notificationId: notification.payload.id,
|
||||
});
|
||||
{
|
||||
const userId = await this.stateService.getUserId();
|
||||
if (await this.authRequestService.getAcceptAuthRequests(userId as UserId)) {
|
||||
this.messagingService.send("openLoginApproval", {
|
||||
notificationId: notification.payload.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user