1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-03-18 14:39:21 +01:00

organization status changed code changes (#12249)

* organization status changed code changes

* Remove the stop so a reconnect can be made
This commit is contained in:
cyprain-okeke 2024-12-18 16:31:16 +01:00 committed by GitHub
parent 903b5c8d93
commit 12b698b11d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 34 additions and 1 deletions

View File

@ -243,6 +243,20 @@ export class AppComponent implements OnDestroy, OnInit {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.router.navigate(["/remove-password"]);
break;
case "syncOrganizationStatusChanged": {
const { organizationId, enabled } = message;
const organizations = await firstValueFrom(this.organizationService.organizations$);
const organization = organizations.find((org) => org.id === organizationId);
if (organization) {
const updatedOrganization = {
...organization,
enabled: enabled,
};
await this.organizationService.upsert(updatedOrganization);
}
break;
}
default:
break;
}

View File

@ -76,7 +76,6 @@ export class AdjustPaymentDialogComponent {
}
});
await response;
await new Promise((resolve) => setTimeout(resolve, 10000));
this.toastService.showToast({
variant: "success",
title: null,

View File

@ -22,4 +22,5 @@ export enum NotificationType {
AuthRequestResponse = 16,
SyncOrganizations = 17,
SyncOrganizationStatusChanged = 18,
}

View File

@ -42,6 +42,9 @@ export class NotificationResponse extends BaseResponse {
case NotificationType.AuthRequestResponse:
this.payload = new AuthRequestPushNotification(payload);
break;
case NotificationType.SyncOrganizationStatusChanged:
this.payload = new OrganizationStatusPushNotification(payload);
break;
default:
break;
}
@ -112,3 +115,14 @@ export class AuthRequestPushNotification extends BaseResponse {
this.userId = this.getResponseProperty("UserId");
}
}
export class OrganizationStatusPushNotification extends BaseResponse {
organizationId: string;
enabled: boolean;
constructor(response: any) {
super(response);
this.organizationId = this.getResponseProperty("OrganizationId");
this.enabled = this.getResponseProperty("Enabled");
}
}

View File

@ -218,6 +218,11 @@ export class NotificationsService implements NotificationsServiceAbstraction {
});
}
break;
case NotificationType.SyncOrganizationStatusChanged:
if (isAuthenticated) {
await this.syncService.fullSync(true);
}
break;
default:
break;
}