From a09983ae35713f5a2bbb100981116d31ce99826e Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 20 Jul 2020 12:26:25 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-2-stable-ee --- lib/event_filter.rb | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'lib/event_filter.rb') 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 -- cgit v1.2.3