aboutsummaryrefslogtreecommitdiff
path: root/internal/db/webhook.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-06-25 18:07:39 +0800
committerGitHub <noreply@github.com>2022-06-25 18:07:39 +0800
commit083c3ee659c6c5542687f3bafae68cbc24dbc90f (patch)
tree0103bf3b5c5ebfccd368a7cb6a425a521fd669d9 /internal/db/webhook.go
parent9df4e3ae3c555a86f691f0d78a43834842e77d8b (diff)
db: refactor "action" table to use GORM (#7054)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/db/webhook.go')
-rw-r--r--internal/db/webhook.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/db/webhook.go b/internal/db/webhook.go
index fee3d1ec..2cebd3fa 100644
--- a/internal/db/webhook.go
+++ b/internal/db/webhook.go
@@ -26,6 +26,7 @@ import (
"gogs.io/gogs/internal/httplib"
"gogs.io/gogs/internal/netutil"
"gogs.io/gogs/internal/sync"
+ "gogs.io/gogs/internal/testutil"
)
var HookQueue = sync.NewUniqueQueue(1000)
@@ -676,6 +677,11 @@ func prepareWebhooks(e Engine, repo *Repository, event HookEventType, p api.Payl
// PrepareWebhooks adds all active webhooks to task queue.
func PrepareWebhooks(repo *Repository, event HookEventType, p api.Payloader) error {
+ // NOTE: To prevent too many cascading changes in a single refactoring PR, we
+ // choose to ignore this function in tests.
+ if x == nil && testutil.InTest {
+ return nil
+ }
return prepareWebhooks(x, repo, event, p)
}