summaryrefslogtreecommitdiffstats
path: root/models/webhook_slack.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-01 21:16:19 -0500
committerUnknwon <u@gogs.io>2015-12-01 21:16:19 -0500
commit834d38a8fbb4fc87b8f3914d5e2aab07a4d7e809 (patch)
tree10427310d5ca34141b5642cf28d30b5c700f6641 /models/webhook_slack.go
parent5572884c6b5b351f9048974873199a69662cfa2b (diff)
downloadgitea-834d38a8fbb4fc87b8f3914d5e2aab07a4d7e809.tar.gz
gitea-834d38a8fbb4fc87b8f3914d5e2aab07a4d7e809.zip
#2045 add short version as fallback to Slack payload
Diffstat (limited to 'models/webhook_slack.go')
-rw-r--r--models/webhook_slack.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/models/webhook_slack.go b/models/webhook_slack.go
index 45766a51ba..9f12738aa0 100644
--- a/models/webhook_slack.go
+++ b/models/webhook_slack.go
@@ -33,8 +33,9 @@ type SlackPayload struct {
}
type SlackAttachment struct {
- Color string `json:"color"`
- Text string `json:"text"`
+ Fallback string `json:"fallback"`
+ Color string `json:"color"`
+ Text string `json:"text"`
}
func (p *SlackPayload) SetSecret(_ string) {}
@@ -111,7 +112,12 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
}
}
- slackAttachments := []SlackAttachment{{Color: slack.Color, Text: attachmentText}}
+ slackAttachments := []SlackAttachment{{
+ Fallback: fmt.Sprintf("%s pushed %s to %s/%s: %s",
+ p.Pusher, commitString, p.Repo.Name, branchName, p.CompareUrl),
+ Color: slack.Color,
+ Text: attachmentText,
+ }}
return &SlackPayload{
Channel: slack.Channel,