public String buildComment(User user, String repositoryName, Commit commit) { if (Strings.isNullOrEmpty(user.getUsername())) { return String.format( "%s mentioned this issue in [a commit of %s|%s] \r\n " + "*%s* : %s", user.getName(), repositoryName, commit.getUrl(), getDateAsString(commit.getTimestamp()), commit.getMessage()); } else { return String.format( "[%s|%s] mentioned this issue in [a commit of %s|%s] \r\n" + "*%s* : %s", user.getName(), gitLabService.getUserUrl(user.getUsername()), repositoryName, commit.getUrl(), getDateAsString(commit.getTimestamp()), commit.getMessage()); } }
public String buildCommentForTransition(User user, String repositoryName, Commit commit) { if (Strings.isNullOrEmpty(user.getUsername())) { return String.format( "%s changed status of this issue in [a commit of %s|%s] to *%s* \r\n\r\n " + "*%s* : %s", user.getName(), repositoryName, commit.getUrl(), JiraService.TRANSITION_HOLDER, getDateAsString(commit.getTimestamp()), commit.getMessage()); } else { return String.format( "[%s|%s] changed status of this issue in [a commit of %s|%s] to *%s* \r\n\r\n" + "*%s* : %s", user.getName(), gitLabService.getUserUrl(user.getUsername()), repositoryName, commit.getUrl(), JiraService.TRANSITION_HOLDER, getDateAsString(commit.getTimestamp()), commit.getMessage()); } }