mirror of
https://github.com/go-gitea/gitea
synced 2025-07-20 09:18:36 +00:00
This PR created a mock webhook server in the tests and added integration tests for generic webhooks. It also fixes bugs in package webhooks and pull request comment webhooks. This also corrected an error on the package webhook. The previous implementation uses a `User` struct as an organization, now it has been corrected but it will not be consistent with the previous implementation, some fields which not belong to the organization have been removed. Backport #33396 Backport part of #33337
This commit is contained in:
@@ -299,6 +299,11 @@ func (w *Webhook) HasPackageEvent() bool {
|
||||
(w.ChooseEvents && w.HookEvents.Package)
|
||||
}
|
||||
|
||||
func (w *Webhook) HasStatusEvent() bool {
|
||||
return w.SendEverything ||
|
||||
(w.ChooseEvents && w.HookEvents.Status)
|
||||
}
|
||||
|
||||
// HasPullRequestReviewRequestEvent returns true if hook enabled pull request review request event.
|
||||
func (w *Webhook) HasPullRequestReviewRequestEvent() bool {
|
||||
return w.SendEverything ||
|
||||
@@ -337,6 +342,7 @@ func (w *Webhook) EventCheckers() []struct {
|
||||
{w.HasReleaseEvent, webhook_module.HookEventRelease},
|
||||
{w.HasPackageEvent, webhook_module.HookEventPackage},
|
||||
{w.HasPullRequestReviewRequestEvent, webhook_module.HookEventPullRequestReviewRequest},
|
||||
{w.HasStatusEvent, webhook_module.HookEventStatus},
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user