Skip to content

Commit db9342c

Browse files
jolheiserlafriks
authored andcommitted
Fix RocketChat (#9908) (#9921)
* Fix RocketChat?? Signed-off-by: jolheiser <[email protected]> * Don't send attachment for repo create/delete Signed-off-by: jolheiser <[email protected]> * Make fmt Signed-off-by: jolheiser <[email protected]> Co-authored-by: Lauris BH <[email protected]> Co-authored-by: Lauris BH <[email protected]>
1 parent 79c1d48 commit db9342c

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

modules/webhook/slack.go

+5-10
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
232232
Username: slack.Username,
233233
IconURL: slack.IconURL,
234234
Attachments: []SlackAttachment{{
235-
Color: slack.Color,
236-
Text: attachmentText,
235+
Color: slack.Color,
236+
Title: p.Repo.HTMLURL,
237+
TitleLink: p.Repo.HTMLURL,
238+
Text: attachmentText,
237239
}},
238240
}, nil
239241
}
@@ -289,12 +291,11 @@ func getSlackPullRequestApprovalPayload(p *api.PullRequestPayload, slack *SlackM
289291
func getSlackRepositoryPayload(p *api.RepositoryPayload, slack *SlackMeta) (*SlackPayload, error) {
290292
senderLink := SlackLinkFormatter(setting.AppURL+p.Sender.UserName, p.Sender.UserName)
291293
repoLink := SlackLinkFormatter(p.Repository.HTMLURL, p.Repository.FullName)
292-
var text, title, attachmentText string
294+
var text string
293295

294296
switch p.Action {
295297
case api.HookRepoCreated:
296298
text = fmt.Sprintf("[%s] Repository created by %s", repoLink, senderLink)
297-
title = p.Repository.HTMLURL
298299
case api.HookRepoDeleted:
299300
text = fmt.Sprintf("[%s] Repository deleted by %s", repoLink, senderLink)
300301
}
@@ -304,12 +305,6 @@ func getSlackRepositoryPayload(p *api.RepositoryPayload, slack *SlackMeta) (*Sla
304305
Text: text,
305306
Username: slack.Username,
306307
IconURL: slack.IconURL,
307-
Attachments: []SlackAttachment{{
308-
Color: slack.Color,
309-
Title: title,
310-
TitleLink: title,
311-
Text: attachmentText,
312-
}},
313308
}, nil
314309
}
315310

0 commit comments

Comments
 (0)