summaryrefslogtreecommitdiffstats
path: root/models/webhook.go
diff options
context:
space:
mode:
authorChristopher Brickley <brickley@gmail.com>2014-09-04 07:17:00 -0400
committerChristopher Brickley <brickley@gmail.com>2014-09-05 07:19:34 -0400
commit85c35a6b8bb7430568d375d1e792e1417bbd7f4b (patch)
treed269e4a890036a76d8f8cd60f8d65e7a0c80d865 /models/webhook.go
parent7269b06fd5992776c07ae0303f85e0d05b1e62e9 (diff)
downloadgitea-85c35a6b8bb7430568d375d1e792e1417bbd7f4b.tar.gz
gitea-85c35a6b8bb7430568d375d1e792e1417bbd7f4b.zip
add organization-level webhooks
Diffstat (limited to 'models/webhook.go')
-rw-r--r--models/webhook.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/models/webhook.go b/models/webhook.go
index 0b7b3a9948..5acc83f592 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -45,6 +45,7 @@ type Webhook struct {
IsActive bool
HookTaskType HookTaskType
Meta string `xorm:"TEXT"` // store hook-specific attributes
+ OrgId int64
}
// GetEvent handles conversion from Events to HookEvent.
@@ -120,6 +121,18 @@ func DeleteWebhook(hookId int64) error {
return err
}
+// GetWebhooksByOrgId returns all webhooks for an organization.
+func GetWebhooksByOrgId(orgId int64) (ws []*Webhook, err error) {
+ err = x.Find(&ws, &Webhook{OrgId: orgId})
+ return ws, err
+}
+
+// GetActiveWebhooksByOrgId returns all active webhooks for an organization.
+func GetActiveWebhooksByOrgId(orgId int64) (ws []*Webhook, err error) {
+ err = x.Find(&ws, &Webhook{OrgId: orgId, IsActive: true})
+ return ws, err
+}
+
// ___ ___ __ ___________ __
// / | \ ____ ____ | | _\__ ___/____ _____| | __
// / ~ \/ _ \ / _ \| |/ / | | \__ \ / ___/ |/ /