2012-11-19 13:24:05 -05:00
|
|
|
class ProjectHook < WebHook
|
2017-07-20 11:12:06 -04:00
|
|
|
TRIGGERS = {
|
|
|
|
push_hooks: :push_events,
|
|
|
|
tag_push_hooks: :tag_push_events,
|
|
|
|
issue_hooks: :issues_events,
|
|
|
|
confidential_issue_hooks: :confidential_issues_events,
|
|
|
|
note_hooks: :note_events,
|
|
|
|
merge_request_hooks: :merge_requests_events,
|
|
|
|
job_hooks: :job_events,
|
|
|
|
pipeline_hooks: :pipeline_events,
|
|
|
|
wiki_page_hooks: :wiki_page_events
|
|
|
|
}.freeze
|
|
|
|
|
|
|
|
TRIGGERS.each do |trigger, event|
|
|
|
|
scope trigger, -> { where(event => true) }
|
|
|
|
end
|
2013-12-02 14:38:32 -05:00
|
|
|
|
2017-07-20 11:12:06 -04:00
|
|
|
belongs_to :project
|
|
|
|
validates :project, presence: true
|
2012-11-19 13:24:05 -05:00
|
|
|
end
|