From e611dbbe866819bc2f933589e208f9a95ad0a9d1 Mon Sep 17 00:00:00 2001 From: John Olheiser <42128690+jolheiser@users.noreply.github.com> Date: Wed, 22 Jan 2020 02:07:11 -0600 Subject: [PATCH] Fix RocketChat (#9925) Signed-off-by: jolheiser --- models/webhook_slack.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/models/webhook_slack.go b/models/webhook_slack.go index fc7263862c..dcc1047599 100644 --- a/models/webhook_slack.go +++ b/models/webhook_slack.go @@ -283,8 +283,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e Username: slack.Username, IconURL: slack.IconURL, Attachments: []SlackAttachment{{ - Color: slack.Color, - Text: attachmentText, + Color: slack.Color, + Title: p.Repo.HTMLURL, + TitleLink: p.Repo.HTMLURL, + Text: attachmentText, }}, }, nil } @@ -380,12 +382,11 @@ func getSlackPullRequestApprovalPayload(p *api.PullRequestPayload, slack *SlackM func getSlackRepositoryPayload(p *api.RepositoryPayload, slack *SlackMeta) (*SlackPayload, error) { senderLink := SlackLinkFormatter(setting.AppURL+p.Sender.UserName, p.Sender.UserName) - var text, title, attachmentText string + var text string switch p.Action { case api.HookRepoCreated: text = fmt.Sprintf("[%s] Repository created by %s", p.Repository.FullName, senderLink) - title = p.Repository.HTMLURL case api.HookRepoDeleted: text = fmt.Sprintf("[%s] Repository deleted by %s", p.Repository.FullName, senderLink) } @@ -395,12 +396,6 @@ func getSlackRepositoryPayload(p *api.RepositoryPayload, slack *SlackMeta) (*Sla Text: text, Username: slack.Username, IconURL: slack.IconURL, - Attachments: []SlackAttachment{{ - Color: slack.Color, - Title: title, - TitleLink: title, - Text: attachmentText, - }}, }, nil }