From 88f0450be260df1319fc524f502be673d77631fb Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Tue, 17 Jan 2023 16:55:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B0=20?= =?UTF-8?q?=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B9=20=D0=BE=20=D0=BF=D0=B0=D0=B9=D0=BF=D0=BB=D0=B0=D0=B9?= =?UTF-8?q?=D0=BD=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bot/gitlab/context/utils/Icons.java | 4 +-- .../notify/PipelineNotifyGenerator.java | 28 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/utils/Icons.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/utils/Icons.java index 117671e..2a0c8c3 100644 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/utils/Icons.java +++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/utils/Icons.java @@ -18,10 +18,10 @@ public class Icons { public static final String DANGEROUS = "⚠️"; public static final String PEN = "✏️"; public static final String ASSIGNEE = "\uD83C\uDFA9"; - public static final String BUILD = "\uD83D\uDEE0"; + public static final String BUILD = "⚙️"; public static final String LINK = "\uD83D\uDD17"; public static final String REVIEWER = "\uD83D\uDD0E"; - public static final String PROJECT = "Project"; + public static final String PROJECT = "\uD83C\uDFD7"; private Icons() { utilityClass(); diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/PipelineNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/PipelineNotifyGenerator.java index 5bd1f94..398c612 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/PipelineNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/PipelineNotifyGenerator.java @@ -24,25 +24,25 @@ public class PipelineNotifyGenerator implements NotifyBoxAnswerGenerator optProjectName = projectService.getProjectNameById(notify.getProjectId()) - .map(Strings::escapeMarkdown); + final StringBuilder builder = new StringBuilder(Icons.BUILD).append(" *New pipeline |").append(notify.getPipelineId()).append("*"); - final StringBuilder builder = new StringBuilder(Icons.BUILD).append(" *Pipeline ").append(notify.getPipelineId()).append("*"); - - if (optProjectName.isPresent()) { - final String projectName = optProjectName.get(); - builder.append(" | ").append(projectName); - } - - final String notifyMessage = builder - .append(Icons.HR) - .append(Icons.TREE).append(": ").append(notify.getRefName()) + builder .append(Icons.HR) .append(notify.getOldStatus().getIcon()).append(" ").append(notify.getOldStatus()).append(Icons.ARROW).append(notify.getNewStatus().getIcon()).append(" ").append(notify.getNewStatus()) - .toString(); + .append(Icons.HR); + + final Optional optProjectName = projectService.getProjectNameById(notify.getProjectId()) + .map(Strings::escapeMarkdown); + if (optProjectName.isPresent()) { + final String projectName = optProjectName.get(); + builder.append(Icons.PROJECT).append(": ").append(projectName).append("\n"); + } + + builder + .append(Icons.TREE).append(": ").append(notify.getRefName()); return boxAnswer( - notifyMessage, + builder.toString(), inlineKeyBoard( simpleLine( simpleButton(Icons.VIEW, "DELETE_MESSAGE"),