summaryrefslogtreecommitdiff
path: root/lib/feature.rb
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2019-02-07 20:27:03 +0000
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2019-02-19 14:57:03 +0800
commit46f66c7f0aa5ddf2f8d996880936d88e6977f6c0 (patch)
tree92b9eea7e05202549d8fb47ac014930dc3a6acdd /lib/feature.rb
parent82423ac34ac90e3ff3443495a14af0105feff67d (diff)
downloadgitlab-ce-46f66c7f0aa5ddf2f8d996880936d88e6977f6c0.tar.gz
Allow setting feature flags per GitLab group
Building on support for setting feature flags by project, this adds support for setting them by GitLab group path. This is different from setting them by Flipper feature_groups, which are for batch updating pre-registered collections.
Diffstat (limited to 'lib/feature.rb')
-rw-r--r--lib/feature.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/feature.rb b/lib/feature.rb
index e59cd70f822..749c861d740 100644
--- a/lib/feature.rb
+++ b/lib/feature.rb
@@ -111,11 +111,11 @@ class Feature
end
def gate_specified?
- %i(user project feature_group).any? { |key| params.key?(key) }
+ %i(user project group feature_group).any? { |key| params.key?(key) }
end
def targets
- [feature_group, user, project].compact
+ [feature_group, user, project, group].compact
end
private
@@ -139,5 +139,11 @@ class Feature
Project.find_by_full_path(params[:project])
end
+
+ def group
+ return unless params.key?(:group)
+
+ Group.find_by_full_path(params[:group])
+ end
end
end