Browse Source

#2045 add short version as fallback to Slack payload

Unknwon 9 years ago
parent
commit
834d38a8fb
1 changed files with 9 additions and 3 deletions
  1. 9 3
      models/webhook_slack.go

+ 9 - 3
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,