aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2021-01-15 01:24:03 +0200
committerGitHub <noreply@github.com>2021-01-15 01:24:03 +0200
commit6eee9f0f4e56e620b2eacfc9c2b59c6448308290 (patch)
tree8aa10ddcc6c7ae19ce0e6f28edff93a16949058a /models
parent84b147c7f0c2575723d3471783cb24078232fe7a (diff)
downloadgitea-6eee9f0f4e56e620b2eacfc9c2b59c6448308290.tar.gz
gitea-6eee9f0f4e56e620b2eacfc9c2b59c6448308290.zip
Merge default and system webhooks under one menu (#14244)
Diffstat (limited to 'models')
-rw-r--r--models/webhook.go20
1 files changed, 3 insertions, 17 deletions
diff --git a/models/webhook.go b/models/webhook.go
index e0a75843db..5174bb6128 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -400,20 +400,6 @@ func GetWebhooksByOrgID(orgID int64, listOptions ListOptions) ([]*Webhook, error
return ws, sess.Find(&ws, &Webhook{OrgID: orgID})
}
-// GetDefaultWebhook returns admin-default webhook by given ID.
-func GetDefaultWebhook(id int64) (*Webhook, error) {
- webhook := &Webhook{ID: id}
- has, err := x.
- Where("repo_id=? AND org_id=? AND is_system_webhook=?", 0, 0, false).
- Get(webhook)
- if err != nil {
- return nil, err
- } else if !has {
- return nil, ErrWebhookNotExist{id}
- }
- return webhook, nil
-}
-
// GetDefaultWebhooks returns all admin-default webhooks.
func GetDefaultWebhooks() ([]*Webhook, error) {
return getDefaultWebhooks(x)
@@ -426,11 +412,11 @@ func getDefaultWebhooks(e Engine) ([]*Webhook, error) {
Find(&webhooks)
}
-// GetSystemWebhook returns admin system webhook by given ID.
-func GetSystemWebhook(id int64) (*Webhook, error) {
+// GetSystemOrDefaultWebhook returns admin system or default webhook by given ID.
+func GetSystemOrDefaultWebhook(id int64) (*Webhook, error) {
webhook := &Webhook{ID: id}
has, err := x.
- Where("repo_id=? AND org_id=? AND is_system_webhook=?", 0, 0, true).
+ Where("repo_id=? AND org_id=?", 0, 0).
Get(webhook)
if err != nil {
return nil, err