diff options
Diffstat (limited to 'lib/event_filter.rb')
-rw-r--r-- | lib/event_filter.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/event_filter.rb b/lib/event_filter.rb index 538727dc422..0b5833b91ed 100644 --- a/lib/event_filter.rb +++ b/lib/event_filter.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class EventFilter + include Gitlab::Utils::StrongMemoize + attr_accessor :filter ALL = 'all' @@ -10,6 +12,7 @@ class EventFilter COMMENTS = 'comments' TEAM = 'team' WIKI = 'wiki' + DESIGNS = 'designs' def initialize(filter) # Split using comma to maintain backward compatibility Ex/ "filter1,filter2" @@ -23,8 +26,6 @@ class EventFilter # rubocop: disable CodeReuse/ActiveRecord def apply_filter(events) - events = apply_feature_flags(events) - case filter when PUSH events.pushed_action @@ -38,6 +39,8 @@ class EventFilter events.where(action: [:created, :updated, :closed, :reopened], target_type: 'Issue') when WIKI wiki_events(events) + when DESIGNS + design_events(events) else events end @@ -46,20 +49,16 @@ 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 design_events(events) + events.for_design + end + def filters - [ALL, PUSH, MERGED, ISSUE, COMMENTS, TEAM, WIKI] + [ALL, PUSH, MERGED, ISSUE, COMMENTS, TEAM, WIKI, DESIGNS] end end |