Исправление уведомления об обновлении 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.setUserAssignee(assigneeChanged.getNewStatus(oldMergeRequest.isUserAssignee()));
mergeRequest.setUserReviewer(reviewerChanged.getNewStatus(oldMergeRequest.isUserReviewer())); mergeRequest.setUserReviewer(reviewerChanged.getNewStatus(oldMergeRequest.isUserReviewer()));
final boolean isChangedMr = !oldMergeRequest.getUpdatedDate().equals(mergeRequest.getUpdatedDate()) final boolean isChangedMr = !oldMergeRequest.getUpdatedDate().equals(mergeRequest.getUpdatedDate()) || oldMergeRequest.isConflict() != mergeRequest.isConflict();
|| oldMergeRequest.isConflict() != mergeRequest.isConflict();
final boolean isChangedLinkedEntity = reviewerChanged.isChanged() || assigneeChanged.isChanged(); final boolean isChangedLinkedEntity = reviewerChanged.isChanged() || assigneeChanged.isChanged();
if (isChangedMr || isChangedLinkedEntity) { if (isChangedMr || isChangedLinkedEntity) {
final MergeRequest savedMergeRequest = repository.save(mergeRequest);
if (oldMergeRequest.isNotification()) { if (oldMergeRequest.isNotification()) {
final Project project = projectService.getByIdOrThrow(mergeRequest.getProjectId()); final Project project = projectService.getByIdOrThrow(mergeRequest.getProjectId());
if (isChangedMr) { if (isChangedMr) {
notifyAboutStatus(oldMergeRequest, savedMergeRequest, project); notifyAboutStatus(oldMergeRequest, mergeRequest, project);
notifyAboutConflict(oldMergeRequest, savedMergeRequest, project); notifyAboutConflict(oldMergeRequest, mergeRequest, project);
notifyAboutUpdate(oldMergeRequest, savedMergeRequest, project); notifyAboutUpdate(oldMergeRequest, mergeRequest, project);
} }
if (isChangedLinkedEntity) { if (isChangedLinkedEntity) {
notifyReviewer(reviewerChanged, savedMergeRequest, project); notifyReviewer(reviewerChanged, mergeRequest, project);
notifyAssignee(assigneeChanged, savedMergeRequest, project); notifyAssignee(assigneeChanged, mergeRequest, project);
} }
} }
return savedMergeRequest; return repository.save(mergeRequest);
} }
return oldMergeRequest; return oldMergeRequest;