diff options
author | 无闻 <joe2010xtmf@163.com> | 2014-09-01 00:12:58 +0800 |
---|---|---|
committer | 无闻 <joe2010xtmf@163.com> | 2014-09-01 00:12:58 +0800 |
commit | 1ed67798acb532dd2e62d2f3cbdde7b34219bfec (patch) | |
tree | 1ec707518cb37307cd05fa5cf6ef6bbf670caf9b /models/action.go | |
parent | 5e6091a30ae4befd68041aaff3f70d7334ce1b1c (diff) | |
parent | 2bce24068dc3c64ee5e501c48b7f080c48383970 (diff) |
Merge pull request #379 from compressed/slack
Slack Support
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/models/action.go b/models/action.go index b5f692c4..d536c84d 100644 --- a/models/action.go +++ b/models/action.go @@ -266,14 +266,33 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, continue } - p.Secret = w.Secret - CreateHookTask(&HookTask{ - Type: WEBHOOK, - Url: w.Url, - Payload: p, - ContentType: w.ContentType, - IsSsl: w.IsSsl, - }) + switch w.HookTaskType { + case SLACK: + { + s, err := GetSlackPayload(p, w.Meta) + if err != nil { + return errors.New("action.GetSlackPayload: " + err.Error()) + } + CreateHookTask(&HookTask{ + Type: w.HookTaskType, + Url: w.Url, + BasePayload: s, + ContentType: w.ContentType, + IsSsl: w.IsSsl, + }) + } + default: + { + p.Secret = w.Secret + CreateHookTask(&HookTask{ + Type: w.HookTaskType, + Url: w.Url, + BasePayload: p, + ContentType: w.ContentType, + IsSsl: w.IsSsl, + }) + } + } } return nil } |