fix format notify PipelineNotify

This commit is contained in:
Struchkov Mark 2024-08-23 20:25:36 +03:00
parent 050ab4eaa7
commit d6512a695c
No known key found for this signature in database
GPG Key ID: A3F0AC3F0FA52F3C

View File

@ -28,19 +28,21 @@ public class PipelineNotifyGenerator implements NotifyBoxAnswerGenerator<Pipelin
final StringBuilder builder = new StringBuilder(Icons.BUILD).append(" *New pipeline | ").append(notify.getPipelineId()).append("*"); final StringBuilder builder = new StringBuilder(Icons.BUILD).append(" *New pipeline | ").append(notify.getPipelineId()).append("*");
builder builder
.append(Icons.HR)
.append(notify.getOldStatus().getIcon()).append(" ").append(notify.getOldStatus()).append(Icons.ARROW).append(notify.getNewStatus().getIcon()).append(" ").append(notify.getNewStatus())
.append(Icons.HR); .append(Icons.HR);
final Optional<String> optProjectName = projectService.getProjectNameById(notify.getProjectId()) final Optional<String> optProjectName = projectService.getProjectNameById(notify.getProjectId())
.map(Strings::escapeMarkdown); .map(Strings::escapeMarkdown);
if (optProjectName.isPresent()) { if (optProjectName.isPresent()) {
final String projectName = optProjectName.get(); final String projectName = optProjectName.get();
builder.append(Icons.PROJECT).append(": ").append(projectName).append("\n"); builder.append(Icons.PROJECT).append(": ").append(projectName).append("\n");
} }
builder builder
.append(Icons.TREE).append(": ").append(notify.getRefName()); .append(Icons.TREE).append(": ").append(notify.getRefName())
.append(Icons.HR)
.append(notify.getOldStatus().getIcon()).append(" ").append(notify.getOldStatus()).append(Icons.ARROW).append(notify.getNewStatus().getIcon()).append(" ").append(notify.getNewStatus());
return BoxAnswer.builder() return BoxAnswer.builder()
.message(builder.toString()) .message(builder.toString())