aboutsummaryrefslogtreecommitdiffstats
path: root/models/webhook.go
diff options
context:
space:
mode:
authorDaniel Grier <daniel.grier@gmail.com>2019-04-20 00:18:06 +1000
committertechknowlogick <matti@mdranta.net>2019-04-19 10:18:06 -0400
commitb9d1fb6de32613ada3869d2a9692cb078ed48534 (patch)
treee02d62ed2bbe2c92cad02ef405316507dc8d120b /models/webhook.go
parent2af67f6044af1cad7136ce8c123e37ab090ca9bc (diff)
downloadgitea-b9d1fb6de32613ada3869d2a9692cb078ed48534.tar.gz
gitea-b9d1fb6de32613ada3869d2a9692cb078ed48534.zip
Add support for MS Teams webhooks (#6632)
Diffstat (limited to 'models/webhook.go')
-rw-r--r--models/webhook.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/models/webhook.go b/models/webhook.go
index 8db281a15c..9be89241a4 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -466,6 +466,7 @@ const (
DISCORD
DINGTALK
TELEGRAM
+ MSTEAMS
)
var hookTaskTypes = map[string]HookTaskType{
@@ -475,6 +476,7 @@ var hookTaskTypes = map[string]HookTaskType{
"discord": DISCORD,
"dingtalk": DINGTALK,
"telegram": TELEGRAM,
+ "msteams": MSTEAMS,
}
// ToHookTaskType returns HookTaskType by given name.
@@ -497,6 +499,8 @@ func (t HookTaskType) Name() string {
return "dingtalk"
case TELEGRAM:
return "telegram"
+ case MSTEAMS:
+ return "msteams"
}
return ""
}
@@ -675,6 +679,11 @@ func prepareWebhook(e Engine, w *Webhook, repo *Repository, event HookEventType,
if err != nil {
return fmt.Errorf("GetTelegramPayload: %v", err)
}
+ case MSTEAMS:
+ payloader, err = GetMSTeamsPayload(p, event, w.Meta)
+ if err != nil {
+ return fmt.Errorf("GetMSTeamsPayload: %v", err)
+ }
default:
p.SetSecret(w.Secret)
payloader = p