diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 15:09:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 15:09:42 +0300 |
commit | 729e3765d5feb762df1ccfbc228a8dd4662aa3f9 (patch) | |
tree | f326420fc64999c6bcc28816ed54f0972fb46459 /lib/event_filter.rb | |
parent | 6f7881ee9dcec34141a8f34fc814b56b366d2b48 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/event_filter.rb')
-rw-r--r-- | lib/event_filter.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/event_filter.rb b/lib/event_filter.rb index e062e3ddb1c..8cb0b1441df 100644 --- a/lib/event_filter.rb +++ b/lib/event_filter.rb @@ -9,6 +9,7 @@ class EventFilter ISSUE = 'issue' COMMENTS = 'comments' TEAM = 'team' + WIKI = 'wiki' def initialize(filter) # Split using comma to maintain backward compatibility Ex/ "filter1,filter2" @@ -22,6 +23,8 @@ class EventFilter # rubocop: disable CodeReuse/ActiveRecord def apply_filter(events) + events = apply_feature_flags(events) + case filter when PUSH events.where(action: Event::PUSHED) @@ -33,6 +36,8 @@ class EventFilter events.where(action: [Event::JOINED, Event::LEFT, Event::EXPIRED]) when ISSUE events.where(action: [Event::CREATED, Event::UPDATED, Event::CLOSED, Event::REOPENED], target_type: 'Issue') + when WIKI + wiki_events(events) else events end @@ -41,8 +46,20 @@ class EventFilter private + def apply_feature_flags(events) + return events.not_wiki_page unless Feature.enabled?(:wiki_events) + + events + end + + def wiki_events(events) + return events unless Feature.enabled?(:wiki_events) + + events.for_wiki_page + end + def filters - [ALL, PUSH, MERGED, ISSUE, COMMENTS, TEAM] + [ALL, PUSH, MERGED, ISSUE, COMMENTS, TEAM, WIKI] end end |