Уведомление об изменении ревьюверов
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Struchkov Mark 2024-09-04 00:16:56 +03:00
parent 625c59f163
commit 0e1e7c6cad
No known key found for this signature in database
GPG Key ID: A3F0AC3F0FA52F3C

View File

@ -68,11 +68,7 @@ public class MergeRequestHandler {
}
}
if (checkNotEmpty(mergeRequest.getReviewers())) {
sendGroupNotifyForReviewers(mergeRequest, projectName);
} else {
sendGroupNotifyAboutNoReviewers(mergeRequest, projectName);
}
sendGroupNotifyForReviewers(mergeRequest, projectName);
}
}
@ -116,6 +112,9 @@ public class MergeRequestHandler {
if (newConflict) {
sendGroupNotifyAboutConflict(newMergeRequest, project.getName());
}
if (reviewerChanged.isChanged()) {
sendGroupNotifyForReviewers(newMergeRequest, project.getName());
}
}
@ -156,22 +155,26 @@ public class MergeRequestHandler {
}
private void sendGroupNotifyForReviewers(MergeRequest mergeRequest, String projectName) {
final Map<Long, String> reviewerTelegramUsernames = personService.getTelegramUsernamesByPersonIds(mergeRequest.getReviewers().stream().map(Person::getId).collect(Collectors.toSet()));
if (!reviewerTelegramUsernames.isEmpty()) {
notifyService.send(
NewMergeRequestGroupNotify.builder()
.mrId(mergeRequest.getId())
.title(mergeRequest.getTitle())
.url(mergeRequest.getWebUrl())
.author(mergeRequest.getAuthor().getName())
.reviewerTelegramUsernames(reviewerTelegramUsernames)
.milestone(mergeRequest.getMilestone())
.projectName(projectName)
.targetBranch(mergeRequest.getTargetBranch())
.sourceBranch(mergeRequest.getSourceBranch())
.description(mergeRequest.getDescription())
.build()
);
if (checkNotEmpty(mergeRequest.getReviewers())) {
final Map<Long, String> reviewerTelegramUsernames = personService.getTelegramUsernamesByPersonIds(mergeRequest.getReviewers().stream().map(Person::getId).collect(Collectors.toSet()));
if (!reviewerTelegramUsernames.isEmpty()) {
notifyService.send(
NewMergeRequestGroupNotify.builder()
.mrId(mergeRequest.getId())
.title(mergeRequest.getTitle())
.url(mergeRequest.getWebUrl())
.author(mergeRequest.getAuthor().getName())
.reviewerTelegramUsernames(reviewerTelegramUsernames)
.milestone(mergeRequest.getMilestone())
.projectName(projectName)
.targetBranch(mergeRequest.getTargetBranch())
.sourceBranch(mergeRequest.getSourceBranch())
.description(mergeRequest.getDescription())
.build()
);
}
} else {
sendGroupNotifyAboutNoReviewers(mergeRequest, projectName);
}
}