diff options
author | Unknwon <u@gogs.io> | 2015-08-29 11:49:59 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-08-29 11:49:59 +0800 |
commit | 55ddf225bb8aba269a407b1d13ab00a497df4f9b (patch) | |
tree | f8609999ba624a7a9cbb4b9fd00ca2bddde38959 /models/webhook_slack.go | |
parent | 2f08e9f04880aedd82be24e191198eff700ddc08 (diff) | |
download | gitea-55ddf225bb8aba269a407b1d13ab00a497df4f9b.tar.gz gitea-55ddf225bb8aba269a407b1d13ab00a497df4f9b.zip |
webhook APIs
Diffstat (limited to 'models/webhook_slack.go')
-rw-r--r-- | models/webhook_slack.go | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/models/webhook_slack.go b/models/webhook_slack.go index b9a39b64e0..45766a51ba 100644 --- a/models/webhook_slack.go +++ b/models/webhook_slack.go @@ -13,22 +13,20 @@ import ( api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/modules/git" - "github.com/gogits/gogs/modules/setting" -) - -const ( - SLACK_COLOR string = "#dd4b39" ) type SlackMeta struct { - Channel string `json:"channel"` + Channel string `json:"channel"` + Username string `json:"username"` + IconURL string `json:"icon_url"` + Color string `json:"color"` } type SlackPayload struct { Channel string `json:"channel"` Text string `json:"text"` Username string `json:"username"` - IconUrl string `json:"icon_url"` + IconURL string `json:"icon_url"` UnfurlLinks int `json:"unfurl_links"` LinkNames int `json:"link_names"` Attachments []SlackAttachment `json:"attachments"` @@ -75,8 +73,8 @@ func getSlackCreatePayload(p *api.CreatePayload, slack *SlackMeta) (*SlackPayloa return &SlackPayload{ Channel: slack.Channel, Text: text, - Username: setting.AppName, - IconUrl: setting.AppUrl + "/img/favicon.png", + Username: slack.Username, + IconURL: slack.IconURL, }, nil } @@ -113,13 +111,13 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e } } - slackAttachments := []SlackAttachment{{Color: SLACK_COLOR, Text: attachmentText}} + slackAttachments := []SlackAttachment{{Color: slack.Color, Text: attachmentText}} return &SlackPayload{ Channel: slack.Channel, Text: text, - Username: setting.AppName, - IconUrl: setting.AppUrl + "/img/favicon.png", + Username: slack.Username, + IconURL: slack.IconURL, Attachments: slackAttachments, }, nil } |