diff options
Diffstat (limited to 'models/webhook.go')
-rw-r--r-- | models/webhook.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/models/webhook.go b/models/webhook.go index 54179ef3..2eee5555 100644 --- a/models/webhook.go +++ b/models/webhook.go @@ -66,6 +66,7 @@ type HookEvents struct { Delete bool `json:"delete"` Fork bool `json:"fork"` Push bool `json:"push"` + Issues bool `json:"issues"` PullRequest bool `json:"pull_request"` } @@ -176,6 +177,12 @@ func (w *Webhook) HasPushEvent() bool { (w.ChooseEvents && w.HookEvents.Push) } +// HasIssuesEvent returns true if hook enabled issues event. +func (w *Webhook) HasIssuesEvent() bool { + return w.SendEverything || + (w.ChooseEvents && w.HookEvents.Issues) +} + // HasPullRequestEvent returns true if hook enabled pull request event. func (w *Webhook) HasPullRequestEvent() bool { return w.SendEverything || @@ -360,6 +367,7 @@ const ( HOOK_EVENT_DELETE HookEventType = "delete" HOOK_EVENT_FORK HookEventType = "fork" HOOK_EVENT_PUSH HookEventType = "push" + HOOK_EVENT_ISSUES HookEventType = "issues" HOOK_EVENT_PULL_REQUEST HookEventType = "pull_request" ) @@ -492,6 +500,10 @@ func prepareHookTasks(e Engine, repo *Repository, event HookEventType, p api.Pay if !w.HasPushEvent() { continue } + case HOOK_EVENT_ISSUES: + if !w.HasIssuesEvent() { + continue + } case HOOK_EVENT_PULL_REQUEST: if !w.HasPullRequestEvent() { continue |