mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00: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:
@@ -243,6 +243,20 @@ export class AppComponent implements OnDestroy, OnInit {
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
this.router.navigate(["/remove-password"]);
|
this.router.navigate(["/remove-password"]);
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ export class AdjustPaymentDialogComponent {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
await response;
|
await response;
|
||||||
await new Promise((resolve) => setTimeout(resolve, 10000));
|
|
||||||
this.toastService.showToast({
|
this.toastService.showToast({
|
||||||
variant: "success",
|
variant: "success",
|
||||||
title: null,
|
title: null,
|
||||||
|
|||||||
@@ -22,4 +22,5 @@ export enum NotificationType {
|
|||||||
AuthRequestResponse = 16,
|
AuthRequestResponse = 16,
|
||||||
|
|
||||||
SyncOrganizations = 17,
|
SyncOrganizations = 17,
|
||||||
|
SyncOrganizationStatusChanged = 18,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ export class NotificationResponse extends BaseResponse {
|
|||||||
case NotificationType.AuthRequestResponse:
|
case NotificationType.AuthRequestResponse:
|
||||||
this.payload = new AuthRequestPushNotification(payload);
|
this.payload = new AuthRequestPushNotification(payload);
|
||||||
break;
|
break;
|
||||||
|
case NotificationType.SyncOrganizationStatusChanged:
|
||||||
|
this.payload = new OrganizationStatusPushNotification(payload);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -112,3 +115,14 @@ export class AuthRequestPushNotification extends BaseResponse {
|
|||||||
this.userId = this.getResponseProperty("UserId");
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -218,6 +218,11 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NotificationType.SyncOrganizationStatusChanged:
|
||||||
|
if (isAuthenticated) {
|
||||||
|
await this.syncService.fullSync(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user