Изменение формата уведомлений о пайплайне
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Struchkov Mark 2023-01-17 16:55:40 +03:00
parent b530c061f3
commit 88f0450be2
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6
2 changed files with 16 additions and 16 deletions

View File

@ -18,10 +18,10 @@ public class Icons {
public static final String DANGEROUS = "⚠️"; public static final String DANGEROUS = "⚠️";
public static final String PEN = "✏️"; public static final String PEN = "✏️";
public static final String ASSIGNEE = "\uD83C\uDFA9"; 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 LINK = "\uD83D\uDD17";
public static final String REVIEWER = "\uD83D\uDD0E"; public static final String REVIEWER = "\uD83D\uDD0E";
public static final String PROJECT = "Project"; public static final String PROJECT = "\uD83C\uDFD7";
private Icons() { private Icons() {
utilityClass(); utilityClass();

View File

@ -24,25 +24,25 @@ public class PipelineNotifyGenerator implements NotifyBoxAnswerGenerator<Pipelin
@Override @Override
public BoxAnswer generate(PipelineNotify notify) { public BoxAnswer generate(PipelineNotify notify) {
final Optional<String> optProjectName = projectService.getProjectNameById(notify.getProjectId()) final StringBuilder builder = new StringBuilder(Icons.BUILD).append(" *New pipeline |").append(notify.getPipelineId()).append("*");
.map(Strings::escapeMarkdown);
final StringBuilder builder = new StringBuilder(Icons.BUILD).append(" *Pipeline ").append(notify.getPipelineId()).append("*"); builder
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())
.append(Icons.HR) .append(Icons.HR)
.append(notify.getOldStatus().getIcon()).append(" ").append(notify.getOldStatus()).append(Icons.ARROW).append(notify.getNewStatus().getIcon()).append(" ").append(notify.getNewStatus()) .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<String> 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( return boxAnswer(
notifyMessage, builder.toString(),
inlineKeyBoard( inlineKeyBoard(
simpleLine( simpleLine(
simpleButton(Icons.VIEW, "DELETE_MESSAGE"), simpleButton(Icons.VIEW, "DELETE_MESSAGE"),