mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-14 20:01:31 +01:00
[PM-13764] - Update Collection Settings (#12734)
* Updating org when collection settings change.
This commit is contained in:
parent
20c8eda986
commit
3550a904dc
@ -231,6 +231,20 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "syncOrganizationCollectionSettingChanged": {
|
||||
const { organizationId, limitCollectionCreation, limitCollectionDeletion } = message;
|
||||
const organizations = await firstValueFrom(this.organizationService.organizations$);
|
||||
const organization = organizations.find((org) => org.id === organizationId);
|
||||
|
||||
if (organization) {
|
||||
await this.organizationService.upsert({
|
||||
...organization,
|
||||
limitCollectionCreation: limitCollectionCreation,
|
||||
limitCollectionDeletion: limitCollectionDeletion,
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -23,4 +23,5 @@ export enum NotificationType {
|
||||
|
||||
SyncOrganizations = 17,
|
||||
SyncOrganizationStatusChanged = 18,
|
||||
SyncOrganizationCollectionSettingChanged = 19,
|
||||
}
|
||||
|
@ -45,6 +45,9 @@ export class NotificationResponse extends BaseResponse {
|
||||
case NotificationType.SyncOrganizationStatusChanged:
|
||||
this.payload = new OrganizationStatusPushNotification(payload);
|
||||
break;
|
||||
case NotificationType.SyncOrganizationCollectionSettingChanged:
|
||||
this.payload = new OrganizationCollectionSettingChangedPushNotification(payload);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -126,3 +129,17 @@ export class OrganizationStatusPushNotification extends BaseResponse {
|
||||
this.enabled = this.getResponseProperty("Enabled");
|
||||
}
|
||||
}
|
||||
|
||||
export class OrganizationCollectionSettingChangedPushNotification extends BaseResponse {
|
||||
organizationId: string;
|
||||
limitCollectionCreation: boolean;
|
||||
limitCollectionDeletion: boolean;
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
|
||||
this.organizationId = this.getResponseProperty("OrganizationId");
|
||||
this.limitCollectionCreation = this.getResponseProperty("LimitCollectionCreation");
|
||||
this.limitCollectionDeletion = this.getResponseProperty("LimitCollectionDeletion");
|
||||
}
|
||||
}
|
||||
|
@ -227,6 +227,11 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
||||
await this.syncService.fullSync(true);
|
||||
}
|
||||
break;
|
||||
case NotificationType.SyncOrganizationCollectionSettingChanged:
|
||||
if (isAuthenticated) {
|
||||
await this.syncService.fullSync(true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user