Skip to content

Commit

Permalink
EPMRPP-99153 fix cascade element deletion (#2164)
Browse files Browse the repository at this point in the history
  • Loading branch information
grabsefx authored Feb 10, 2025
1 parent 2421a0a commit 40cd503
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public OperationCompletionRS deletePatternTemplate(String projectName, ReportPor
.orElseThrow(() -> new ReportPortalException(ErrorType.PATTERN_TEMPLATE_NOT_FOUND_IN_PROJECT, id, project.getName()));
PatternTemplateActivityResource before = PatternTemplateConverter.TO_ACTIVITY_RESOURCE.apply(patternTemplate);

patternTemplateRepository.deleteById(patternTemplate.getId());
project.getPatternTemplates().removeIf(pt -> pt.getId().equals(id));

messageBus.publishActivity(new PatternDeletedEvent(user.getUserId(), user.getUsername(), before));
return new OperationCompletionRS(Suppliers.formattedSupplier("Pattern template with id = '{}' has been successfully removed.", id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public OperationCompletionRS deleteNotification(Project project, Long notificati
ErrorType.BAD_REQUEST_ERROR, Suppliers.formattedSupplier(
"Notification '{}' not found. Did you use correct Notification ID?", notificationId)
.get());
senderCaseRepository.deleteSenderCaseById(notificationId);

ProjectResource projectResource = projectConverter.TO_PROJECT_RESOURCE.apply(project);
ProjectNotificationConfigDTO projectNotificationConfigDTO =
Expand All @@ -74,6 +73,8 @@ public OperationCompletionRS deleteNotification(Project project, Long notificati
scs.stream().filter(sc -> !Objects.equals(sc.getId(), notificationId))
.collect(Collectors.toList())));

project.getSenderCases().removeIf(sc -> sc.getId().equals(notificationId));

messageBus.publishActivity(new NotificationsConfigUpdatedEvent(projectResource,
projectResource.getConfiguration().getProjectConfig(), user.getUserId(), user.getUsername()
));
Expand Down

0 comments on commit 40cd503

Please sign in to comment.