summaryrefslogtreecommitdiffstats
path: root/models/action.go
diff options
context:
space:
mode:
authorChristopher Brickley <brickley@gmail.com>2014-08-24 08:59:47 -0400
committerChristopher Brickley <brickley@gmail.com>2014-08-31 12:01:59 -0400
commit2bce24068dc3c64ee5e501c48b7f080c48383970 (patch)
tree1ec707518cb37307cd05fa5cf6ef6bbf670caf9b /models/action.go
parent5e6091a30ae4befd68041aaff3f70d7334ce1b1c (diff)
downloadgitea-2bce24068dc3c64ee5e501c48b7f080c48383970.tar.gz
gitea-2bce24068dc3c64ee5e501c48b7f080c48383970.zip
add Slack API webhook support
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go35
1 files changed, 27 insertions, 8 deletions
diff --git a/models/action.go b/models/action.go
index b5f692c49f..d536c84dd0 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
}