From e1c9436a14901ecdf76398fef78f3528e379a934 Mon Sep 17 00:00:00 2001 From: upagge Date: Sun, 11 Oct 2020 11:53:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=BE=D0=B9=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D0=BD=D0=B3=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-dev.yaml | 2 +- .../domain/notify/comment/AnswerCommentNotify.java | 4 ++-- .../domain/notify/pullrequest/ReviewersPrNotify.java | 12 ++++++------ .../domain/notify/pullrequest/StatusPrNotify.java | 4 ++-- .../vcs/core/domain/notify/task/TaskCloseNotify.java | 4 ++-- .../vcs/core/domain/notify/task/TaskNewNotify.java | 4 ++-- .../vcs/core/scheduler/NotificationScheduler.java | 4 ++-- .../java/org/sadtech/bot/vcs/core/utils/Smile.java | 1 + 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/bitbucket-app/src/main/resources/application-dev.yaml b/bitbucket-app/src/main/resources/application-dev.yaml index 470c8f4..015a267 100644 --- a/bitbucket-app/src/main/resources/application-dev.yaml +++ b/bitbucket-app/src/main/resources/application-dev.yaml @@ -26,7 +26,7 @@ bitbucketbot: no-comment-count: 20 comment-count: 100 init: - start-comment-id: 8157 + start-comment-id: 8301 use: false bitbucket: token: ${BITBUCKET_ADMIN_TOKEN} diff --git a/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/comment/AnswerCommentNotify.java b/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/comment/AnswerCommentNotify.java index ff54804..d60a0cc 100644 --- a/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/comment/AnswerCommentNotify.java +++ b/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/comment/AnswerCommentNotify.java @@ -37,10 +37,10 @@ public class AnswerCommentNotify extends Notify { @Override public String generateMessage() { final String answerText = answers.stream() - .map(answer -> "*" + answer.getAuthorName() + "*: " + answer.getMessage().substring(0, Math.min(answer.getMessage().length(), 500))) + .map(answer -> answer.getAuthorName() + ": " + answer.getMessage().substring(0, Math.min(answer.getMessage().length(), 500))) .collect(Collectors.joining("\n\n")); return MessageFormat.format( - "{0} *Новые ответы на ваш комментарий* | [ПР]({1}){2}" + + "{0} *Новые ответы* на [комментарий]({1}){2}" + "{3}{2}" + "{4}", Smile.BELL, diff --git a/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/pullrequest/ReviewersPrNotify.java b/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/pullrequest/ReviewersPrNotify.java index d155a2f..31932f4 100644 --- a/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/pullrequest/ReviewersPrNotify.java +++ b/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/pullrequest/ReviewersPrNotify.java @@ -37,25 +37,25 @@ public class ReviewersPrNotify extends PrNotify { final Map> changes = reviewerChanges.stream() .collect(Collectors.groupingBy(ReviewerChange::getType)); if (changes.containsKey(OLD)) { - stringBuilder.append(Smile.BR).append("Изменили свое решение:").append(Smile.BR); changes.get(OLD).forEach( change -> stringBuilder .append(Smile.AUTHOR).append(change.getName()).append(": ") - .append(change.getOldStatus().getValue()).append(" -> ") + .append(change.getOldStatus().getValue()).append(" ").append(Smile.ARROW).append(" ") .append(change.getStatus().getValue()) .append(Smile.BR) ); + stringBuilder.append(Smile.BR); } if (changes.containsKey(NEW)) { - stringBuilder.append(Smile.BR).append("Новые ревьюверы:").append(Smile.BR); + stringBuilder.append("Новые ревьюверы:").append(Smile.BR); changes.get(NEW).forEach( change -> stringBuilder - .append(change.getName()).append(" (").append(change.getStatus().getValue()).append(")") - .append(Smile.BR) + .append(change.getName()).append(": ").append(change.getStatus().getValue()).append(Smile.BR) ); + stringBuilder.append(Smile.BR); } if (changes.containsKey(DELETED)) { - stringBuilder.append(Smile.BR).append("Не выдержали ревью:").append(Smile.BR) + stringBuilder.append("Не выдержали ревью:").append(Smile.BR) .append( changes.get(DELETED).stream() .map(ReviewerChange::getName).collect(Collectors.joining(",")) diff --git a/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/pullrequest/StatusPrNotify.java b/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/pullrequest/StatusPrNotify.java index 687bc10..97e3115 100644 --- a/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/pullrequest/StatusPrNotify.java +++ b/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/pullrequest/StatusPrNotify.java @@ -33,8 +33,8 @@ public class StatusPrNotify extends PrNotify { return MessageFormat.format( "{0} *Изменился статус вашего ПР*{1}" + "[{2}]({3}){1}" + - "{4} -> {5}\n\n", - Smile.PEN, Smile.HR, title, url, oldStatus.name(), newStatus.name() + "{4}{5}{6}\n\n", + Smile.PEN, Smile.HR, title, url, oldStatus.name(), Smile.ARROW, newStatus.name() ); } diff --git a/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/task/TaskCloseNotify.java b/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/task/TaskCloseNotify.java index 78d315a..aa39122 100644 --- a/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/task/TaskCloseNotify.java +++ b/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/task/TaskCloseNotify.java @@ -26,8 +26,8 @@ public class TaskCloseNotify extends TaskNotify { @Override public String generateMessage() { return MessageFormat.format( - "{0} *Задача выполнена* | [ПР]({1}){2}" + - "{3}: {4}", + "{0} *Закрыта* [задача]({1}){2}" + + "*{3}*: {4}", Smile.TASK, url, Smile.HR, authorName, escapeMarkdown(messageTask) ); } diff --git a/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/task/TaskNewNotify.java b/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/task/TaskNewNotify.java index 618c26a..2451402 100644 --- a/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/task/TaskNewNotify.java +++ b/bot-core/src/main/java/org/sadtech/bot/vcs/core/domain/notify/task/TaskNewNotify.java @@ -28,8 +28,8 @@ public class TaskNewNotify extends TaskNotify { @Override public String generateMessage() { return MessageFormat.format( - "{0} *Назначена новая задача* | [ПР]({1}){2}" + - "{3}: {4}", + "{0} *Назначена новая* [задача]({1}){2}" + + "*{3}*: {4}", Smile.TASK, url, Smile.HR, authorName, escapeMarkdown(messageTask) ); } diff --git a/bot-core/src/main/java/org/sadtech/bot/vcs/core/scheduler/NotificationScheduler.java b/bot-core/src/main/java/org/sadtech/bot/vcs/core/scheduler/NotificationScheduler.java index 0bcb1ec..2d4f77f 100644 --- a/bot-core/src/main/java/org/sadtech/bot/vcs/core/scheduler/NotificationScheduler.java +++ b/bot-core/src/main/java/org/sadtech/bot/vcs/core/scheduler/NotificationScheduler.java @@ -39,7 +39,7 @@ public class NotificationScheduler { private final AppProperty appProperty; // Утреннее сообщение - @Scheduled(cron = "0 */1 * * * *") + @Scheduled(cron = "0 15 8 * * MON-FRI") public void goodMorning() { List allRegister = personService.getAllRegister(); for (Person user : allRegister) { @@ -61,7 +61,7 @@ public class NotificationScheduler { } } - @Scheduled(cron = "0 29 10 * * MON-FRI") + @Scheduled(cron = "0 44 10 * * MON-FRI") public void tks() { List usersTks = personService.getAllRegister().stream() .filter(user -> tksLoginNotify.contains(user.getLogin())) diff --git a/bot-core/src/main/java/org/sadtech/bot/vcs/core/utils/Smile.java b/bot-core/src/main/java/org/sadtech/bot/vcs/core/utils/Smile.java index 2654b9a..d5c12a5 100644 --- a/bot-core/src/main/java/org/sadtech/bot/vcs/core/utils/Smile.java +++ b/bot-core/src/main/java/org/sadtech/bot/vcs/core/utils/Smile.java @@ -34,6 +34,7 @@ public enum Smile { LUPA("\uD83D\uDD0D"), DANGEROUS("⚠️"), BELL("\uD83D\uDECE"), + ARROW("➜"), HR("\n -- -- -- -- --\n"), FAILURE("❌"), SUCCESS("✅"),