mirror of
https://github.com/bitwarden/server
synced 2025-12-24 20:23:21 +00:00
[PM-24011] Create new policy sync push notification (#6594)
* create new policy sync push notification * CR feedback * add tests, fix typo
This commit is contained in:
@@ -231,9 +231,26 @@ public class HubHelpers
|
||||
await _hubContext.Clients.User(pendingTasksData.Payload.UserId.ToString())
|
||||
.SendAsync(_receiveMessageMethod, pendingTasksData, cancellationToken);
|
||||
break;
|
||||
case PushType.PolicyChanged:
|
||||
await policyChangedNotificationHandler(notificationJson, cancellationToken);
|
||||
break;
|
||||
default:
|
||||
_logger.LogWarning("Notification type '{NotificationType}' has not been registered in HubHelpers and will not be pushed as as result", notification.Type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task policyChangedNotificationHandler(string notificationJson, CancellationToken cancellationToken)
|
||||
{
|
||||
var policyData = JsonSerializer.Deserialize<PushNotificationData<SyncPolicyPushNotification>>(notificationJson, _deserializerOptions);
|
||||
if (policyData is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(NotificationsHub.GetOrganizationGroup(policyData.Payload.OrganizationId))
|
||||
.SendAsync(_receiveMessageMethod, policyData, cancellationToken);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user