aboutsummaryrefslogtreecommitdiffstats
path: root/models/webhook.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-11-21 12:26:43 +0800
committerLauris BH <lauris@nix.lv>2017-11-21 06:26:43 +0200
commit10b54df2b2efa539fbaa0bf624e81cb5da99f97a (patch)
tree24d30bb8fdb9f4396b0bc5212b3a95b6fa09cb93 /models/webhook.go
parent420fc8efc24d7a77598307557e5b38077d0efafc (diff)
downloadgitea-10b54df2b2efa539fbaa0bf624e81cb5da99f97a.tar.gz
gitea-10b54df2b2efa539fbaa0bf624e81cb5da99f97a.zip
Add dingtalk webhook (#2777)
* add dingtalk webhook type * add vendor * some fixes * fix name check * fix name check & improvment
Diffstat (limited to 'models/webhook.go')
-rw-r--r--models/webhook.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/models/webhook.go b/models/webhook.go
index 508fea9977..1b601b4e62 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -332,13 +332,15 @@ const (
SLACK
GITEA
DISCORD
+ DINGTALK
)
var hookTaskTypes = map[string]HookTaskType{
- "gitea": GITEA,
- "gogs": GOGS,
- "slack": SLACK,
- "discord": DISCORD,
+ "gitea": GITEA,
+ "gogs": GOGS,
+ "slack": SLACK,
+ "discord": DISCORD,
+ "dingtalk": DINGTALK,
}
// ToHookTaskType returns HookTaskType by given name.
@@ -357,6 +359,8 @@ func (t HookTaskType) Name() string {
return "slack"
case DISCORD:
return "discord"
+ case DINGTALK:
+ return "dingtalk"
}
return ""
}
@@ -520,6 +524,11 @@ func prepareWebhook(e Engine, w *Webhook, repo *Repository, event HookEventType,
if err != nil {
return fmt.Errorf("GetDiscordPayload: %v", err)
}
+ case DINGTALK:
+ payloader, err = GetDingtalkPayload(p, event, w.Meta)
+ if err != nil {
+ return fmt.Errorf("GetDingtalkPayload: %v", err)
+ }
default:
p.SetSecret(w.Secret)
payloader = p