diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-09-01 00:16:14 +0800 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-09-01 00:16:14 +0800 |
commit | bf5595f9a0ee41a30ab04348e02d87ee9f53969a (patch) | |
tree | 93f58ac671e7e9cf1b8b978772075db5dd74928b /models/action.go | |
parent | 36661f53e6cb7bd5fe202157f794255d4d6932af (diff) | |
parent | 1ed67798acb532dd2e62d2f3cbdde7b34219bfec (diff) |
Merge branch 'dev' of github.com:gogits/gogs into dev
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 } |