Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 15:26:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 15:26:25 +0300
commita09983ae35713f5a2bbb100981116d31ce99826e (patch)
tree2ee2af7bd104d57086db360a7e6d8c9d5d43667a /lib/event_filter.rb
parent18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff)
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'lib/event_filter.rb')
-rw-r--r--lib/event_filter.rb21
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