Исправление уведомления об обновлении MR

This commit is contained in:
Struchkov Mark 2023-01-17 00:36:07 +03:00
parent 03b8675c78
commit f2bd5247ae
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6

View File

@ -156,28 +156,26 @@ public class MergeRequestsServiceImpl implements MergeRequestsService {
mergeRequest.setUserAssignee(assigneeChanged.getNewStatus(oldMergeRequest.isUserAssignee()));
mergeRequest.setUserReviewer(reviewerChanged.getNewStatus(oldMergeRequest.isUserReviewer()));
final boolean isChangedMr = !oldMergeRequest.getUpdatedDate().equals(mergeRequest.getUpdatedDate())
|| oldMergeRequest.isConflict() != mergeRequest.isConflict();
final boolean isChangedMr = !oldMergeRequest.getUpdatedDate().equals(mergeRequest.getUpdatedDate()) || oldMergeRequest.isConflict() != mergeRequest.isConflict();
final boolean isChangedLinkedEntity = reviewerChanged.isChanged() || assigneeChanged.isChanged();
if (isChangedMr || isChangedLinkedEntity) {
final MergeRequest savedMergeRequest = repository.save(mergeRequest);
if (oldMergeRequest.isNotification()) {
final Project project = projectService.getByIdOrThrow(mergeRequest.getProjectId());
if (isChangedMr) {
notifyAboutStatus(oldMergeRequest, savedMergeRequest, project);
notifyAboutConflict(oldMergeRequest, savedMergeRequest, project);
notifyAboutUpdate(oldMergeRequest, savedMergeRequest, project);
notifyAboutStatus(oldMergeRequest, mergeRequest, project);
notifyAboutConflict(oldMergeRequest, mergeRequest, project);
notifyAboutUpdate(oldMergeRequest, mergeRequest, project);
}
if (isChangedLinkedEntity) {
notifyReviewer(reviewerChanged, savedMergeRequest, project);
notifyAssignee(assigneeChanged, savedMergeRequest, project);
notifyReviewer(reviewerChanged, mergeRequest, project);
notifyAssignee(assigneeChanged, mergeRequest, project);
}
}
return savedMergeRequest;
return repository.save(mergeRequest);
}
return oldMergeRequest;