summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>2020-01-21 14:29:24 -0600
committerAntoine GIRARD <sapk@users.noreply.github.com>2020-01-21 21:29:24 +0100
commit38a6b11015b64623d738e95e702ab7b1b3b6e71e (patch)
tree03f63b85739837ecf67972091dd2c3f723dd8b6f /modules
parenta315e091e4b025e0622fafd4b46b7f52bc18e18d (diff)
downloadgitea-38a6b11015b64623d738e95e702ab7b1b3b6e71e.tar.gz
gitea-38a6b11015b64623d738e95e702ab7b1b3b6e71e.zip
Fix RocketChat (#9908)
* Fix RocketChat?? Signed-off-by: jolheiser <john.olheiser@gmail.com> * Don't send attachment for repo create/delete Signed-off-by: jolheiser <john.olheiser@gmail.com> * Make fmt Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'modules')
-rw-r--r--modules/webhook/slack.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/modules/webhook/slack.go b/modules/webhook/slack.go
index 74361509d8..361e15ece5 100644
--- a/modules/webhook/slack.go
+++ b/modules/webhook/slack.go
@@ -232,8 +232,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
}
@@ -289,12 +291,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)
repoLink := SlackLinkFormatter(p.Repository.HTMLURL, p.Repository.FullName)
- var text, title, attachmentText string
+ var text string
switch p.Action {
case api.HookRepoCreated:
text = fmt.Sprintf("[%s] Repository created by %s", repoLink, senderLink)
- title = p.Repository.HTMLURL
case api.HookRepoDeleted:
text = fmt.Sprintf("[%s] Repository deleted by %s", repoLink, senderLink)
}
@@ -304,12 +305,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
}