diff options
author | Unknwon <u@gogs.io> | 2015-03-18 04:51:02 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-03-18 04:51:02 -0400 |
commit | 82f7a01ded7e83d238d687831bcd6ec415da31f5 (patch) | |
tree | b5fc75e87bea64dd1d0064dace2be851467467fa /models/action.go | |
parent | 49aeb87e44b315b0a2de6ce82600311bd24be9f7 (diff) | |
download | gitea-82f7a01ded7e83d238d687831bcd6ec415da31f5.tar.gz gitea-82f7a01ded7e83d238d687831bcd6ec415da31f5.zip |
#1064: X-Gogs-Event header is empty
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/models/action.go b/models/action.go index 037ccbd611..d3393728fb 100644 --- a/models/action.go +++ b/models/action.go @@ -417,32 +417,28 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, continue } + var payload BasePayload 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, - }) + s, err := GetSlackPayload(p, w.Meta) + if err != nil { + return errors.New("action.GetSlackPayload: " + err.Error()) } + payload = s default: - { - p.Secret = w.Secret - CreateHookTask(&HookTask{ - Type: w.HookTaskType, - Url: w.Url, - BasePayload: p, - ContentType: w.ContentType, - IsSsl: w.IsSsl, - }) - } + payload = p + p.Secret = w.Secret + } + + if err = CreateHookTask(&HookTask{ + Type: w.HookTaskType, + Url: w.Url, + BasePayload: payload, + ContentType: w.ContentType, + EventType: HOOK_EVENT_PUSH, + IsSsl: w.IsSsl, + }); err != nil { + return fmt.Errorf("CreateHookTask: %v", err) } } |