aboutsummaryrefslogtreecommitdiff
path: root/models/action.go
diff options
context:
space:
mode:
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 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
}