Небольшой рефакторинг сообщений

This commit is contained in:
upagge 2020-10-11 11:53:39 +03:00
parent 2b49d95412
commit e1c9436a14
No known key found for this signature in database
GPG Key ID: 15CD012E46F6BA34
8 changed files with 18 additions and 17 deletions

View File

@ -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}

View File

@ -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,

View File

@ -37,25 +37,25 @@ public class ReviewersPrNotify extends PrNotify {
final Map<ReviewerChange.Type, List<ReviewerChange>> 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(","))

View File

@ -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()
);
}

View File

@ -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)
);
}

View File

@ -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)
);
}

View File

@ -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<Person> 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<Person> usersTks = personService.getAllRegister().stream()
.filter(user -> tksLoginNotify.contains(user.getLogin()))

View File

@ -34,6 +34,7 @@ public enum Smile {
LUPA("\uD83D\uDD0D"),
DANGEROUS("⚠️"),
BELL("\uD83D\uDECE"),
ARROW(""),
HR("\n -- -- -- -- --\n"),
FAILURE(""),
SUCCESS(""),