1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

PM-10564: Notification create push notification simplification.

NotificationStatus not needed.
This commit is contained in:
Maciej Zieniuk
2024-11-21 22:43:14 +00:00
parent 01c814595e
commit 3885885d5f
12 changed files with 63 additions and 108 deletions

View File

@ -37,7 +37,7 @@ public class CreateNotificationCommand : ICreateNotificationCommand
var newNotification = await _notificationRepository.CreateAsync(notification);
await _pushNotificationService.PushSyncNotificationCreateAsync(newNotification, null);
await _pushNotificationService.PushSyncNotificationCreateAsync(newNotification);
return newNotification;
}

View File

@ -182,7 +182,7 @@ public class NotificationHubPushNotificationService : IPushNotificationService
await PushAuthRequestAsync(authRequest, PushType.AuthRequestResponse);
}
public async Task PushSyncNotificationCreateAsync(Notification notification, NotificationStatus? notificationStatus)
public async Task PushSyncNotificationCreateAsync(Notification notification)
{
var message = new SyncNotificationPushNotification
{
@ -190,9 +190,7 @@ public class NotificationHubPushNotificationService : IPushNotificationService
UserId = notification.UserId,
OrganizationId = notification.OrganizationId,
ClientType = notification.ClientType,
RevisionDate = notification.RevisionDate,
ReadDate = notificationStatus?.ReadDate,
DeletedDate = notificationStatus?.DeletedDate
RevisionDate = notification.RevisionDate
};
if (notification.UserId.HasValue)

View File

@ -24,7 +24,7 @@ public interface IPushNotificationService
Task PushSyncSendCreateAsync(Send send);
Task PushSyncSendUpdateAsync(Send send);
Task PushSyncSendDeleteAsync(Send send);
Task PushSyncNotificationCreateAsync(Notification notification, NotificationStatus? notificationStatus);
Task PushSyncNotificationCreateAsync(Notification notification);
Task PushSyncNotificationUpdateAsync(Notification notification, NotificationStatus? notificationStatus);
Task PushAuthRequestAsync(AuthRequest authRequest);
Task PushAuthRequestResponseAsync(AuthRequest authRequest);

View File

@ -165,7 +165,7 @@ public class AzureQueuePushNotificationService : IPushNotificationService
await PushSendAsync(send, PushType.SyncSendDelete);
}
public async Task PushSyncNotificationCreateAsync(Notification notification, NotificationStatus? notificationStatus)
public async Task PushSyncNotificationCreateAsync(Notification notification)
{
var message = new SyncNotificationPushNotification
{
@ -173,9 +173,7 @@ public class AzureQueuePushNotificationService : IPushNotificationService
UserId = notification.UserId,
OrganizationId = notification.OrganizationId,
ClientType = notification.ClientType,
RevisionDate = notification.RevisionDate,
ReadDate = notificationStatus?.ReadDate,
DeletedDate = notificationStatus?.DeletedDate
RevisionDate = notification.RevisionDate
};
await SendMessageAsync(PushType.SyncNotificationCreate, message, true);

View File

@ -146,9 +146,9 @@ public class MultiServicePushNotificationService : IPushNotificationService
return Task.FromResult(0);
}
public Task PushSyncNotificationCreateAsync(Notification notification, NotificationStatus? notificationStatus)
public Task PushSyncNotificationCreateAsync(Notification notification)
{
PushToServices((s) => s.PushSyncNotificationCreateAsync(notification, notificationStatus));
PushToServices((s) => s.PushSyncNotificationCreateAsync(notification));
return Task.CompletedTask;
}

View File

@ -172,7 +172,7 @@ public class NotificationsApiPushNotificationService : BaseIdentityClientService
await PushSendAsync(send, PushType.SyncSendDelete);
}
public async Task PushSyncNotificationCreateAsync(Notification notification, NotificationStatus? notificationStatus)
public async Task PushSyncNotificationCreateAsync(Notification notification)
{
var message = new SyncNotificationPushNotification
{
@ -180,9 +180,7 @@ public class NotificationsApiPushNotificationService : BaseIdentityClientService
UserId = notification.UserId,
OrganizationId = notification.OrganizationId,
ClientType = notification.ClientType,
RevisionDate = notification.RevisionDate,
ReadDate = notificationStatus?.ReadDate,
DeletedDate = notificationStatus?.DeletedDate
RevisionDate = notification.RevisionDate
};
await SendMessageAsync(PushType.SyncNotificationCreate, message, true);

View File

@ -190,7 +190,7 @@ public class RelayPushNotificationService : BaseIdentityClientService, IPushNoti
await SendPayloadToUserAsync(authRequest.UserId, type, message, true);
}
public async Task PushSyncNotificationCreateAsync(Notification notification, NotificationStatus? notificationStatus)
public async Task PushSyncNotificationCreateAsync(Notification notification)
{
var message = new SyncNotificationPushNotification
{
@ -198,9 +198,7 @@ public class RelayPushNotificationService : BaseIdentityClientService, IPushNoti
UserId = notification.UserId,
OrganizationId = notification.OrganizationId,
ClientType = notification.ClientType,
RevisionDate = notification.RevisionDate,
ReadDate = notificationStatus?.ReadDate,
DeletedDate = notificationStatus?.DeletedDate
RevisionDate = notification.RevisionDate
};
if (notification.UserId.HasValue)

View File

@ -106,7 +106,7 @@ public class NoopPushNotificationService : IPushNotificationService
return Task.FromResult(0);
}
public Task PushSyncNotificationCreateAsync(Notification notification, NotificationStatus? notificationStatus) => Task.CompletedTask;
public Task PushSyncNotificationCreateAsync(Notification notification) => Task.CompletedTask;
public Task PushSyncNotificationUpdateAsync(Notification notification, NotificationStatus? notificationStatus) => Task.CompletedTask;
}