1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

PM-10564: CreateNotificationStatusCommand sends wrong create push event type.

Any update to the Notification from user perspective should be treated as update. That includes NotificationStatus, which when created would be displayed as update to the notification. Hence, push notification should be update type.
This commit is contained in:
Maciej Zieniuk
2024-11-21 22:26:12 +00:00
parent 6e69c8a0ce
commit 01c814595e
2 changed files with 5 additions and 5 deletions

View File

@ -48,7 +48,7 @@ public class CreateNotificationStatusCommand : ICreateNotificationStatusCommand
var newNotificationStatus = await _notificationStatusRepository.CreateAsync(notificationStatus);
await _pushNotificationService.PushSyncNotificationCreateAsync(notification, newNotificationStatus);
await _pushNotificationService.PushSyncNotificationUpdateAsync(notification, newNotificationStatus);
return newNotificationStatus;
}

View File

@ -53,7 +53,7 @@ public class CreateNotificationStatusCommandTest
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.CreateAsync(notificationStatus));
await sutProvider.GetDependency<IPushNotificationService>()
.Received(0)
.PushSyncNotificationCreateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
}
[Theory]
@ -67,7 +67,7 @@ public class CreateNotificationStatusCommandTest
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.CreateAsync(notificationStatus));
await sutProvider.GetDependency<IPushNotificationService>()
.Received(0)
.PushSyncNotificationCreateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
}
[Theory]
@ -81,7 +81,7 @@ public class CreateNotificationStatusCommandTest
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.CreateAsync(notificationStatus));
await sutProvider.GetDependency<IPushNotificationService>()
.Received(0)
.PushSyncNotificationCreateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
}
[Theory]
@ -97,6 +97,6 @@ public class CreateNotificationStatusCommandTest
Assert.Equal(notificationStatus, newNotificationStatus);
await sutProvider.GetDependency<IPushNotificationService>()
.Received(1)
.PushSyncNotificationCreateAsync(notification, notificationStatus);
.PushSyncNotificationUpdateAsync(notification, notificationStatus);
}
}