Merge branch 'RED-5949' into 'master'

RED-5949: Wrong notificationType for specific endpoint

Closes RED-5949

See merge request redactmanager/persistence-service!307
This commit is contained in:
Maverick Studer 2024-01-15 12:29:40 +01:00
commit 16d182a513

View File

@ -350,14 +350,16 @@ public class StatusController implements StatusResource {
private void generatePossibleUnassignedFromFileNotification(String dossierId, String fileId, FileModel oldFileStatus, String newAssigneeId) {
if (oldFileStatus.getAssignee() != null && !oldFileStatus.getAssignee().equals(newAssigneeId) && !KeycloakSecurity.getUserId().equals(oldFileStatus.getAssignee())) {
notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
.userId(oldFileStatus.getAssignee())
.issuerId(KeycloakSecurity.getUserId())
.notificationType(NotificationType.UNASSIGNED_FROM_FILE.name())
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, oldFileStatus.getFilename()))
.build());
if (oldFileStatus.getAssignee() == null || newAssigneeId == null || oldFileStatus.getAssignee().equals(newAssigneeId) || KeycloakSecurity.getUserId().equals(oldFileStatus.getAssignee())) {
return;
}
notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
.userId(oldFileStatus.getAssignee())
.issuerId(KeycloakSecurity.getUserId())
.notificationType(NotificationType.UNASSIGNED_FROM_FILE.name())
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, oldFileStatus.getFilename()))
.build());
}