summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2018-03-12 20:51:27 +0100
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2018-03-12 20:51:27 +0100
commit0337ccaf443345d904bdcf57eacefa3bdb640ea4 (patch)
treeeb661addec8c09887c306b395f9dbbcd2c3074ae
parent311465d248e6a7b11b20cd4fb8032ea4f1fe3b3c (diff)
downloadgitlab-ce-gitaly-feature-on-early-return.tar.gz
Fix annoyance in Feature API where enabling a feature using 'true' will not enabled itgitaly-feature-on-early-return
-rw-r--r--lib/api/features.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/api/features.rb b/lib/api/features.rb
index 9385c6ca174..38450ce7107 100644
--- a/lib/api/features.rb
+++ b/lib/api/features.rb
@@ -5,7 +5,7 @@ module API
helpers do
def gate_value(params)
case params[:value]
- when 'true'
+ when '100', 'true'
true
when '0', 'false'
false
@@ -49,7 +49,13 @@ module API
case value
when true
if targets.present?
- targets.each { |target| feature.enable(target) }
+ targets.each do |target|
+ # We need to disable it first so that the percentage_of_time_value
+ # gate gets reset otherwise setting it to 'true' will do nothing
+ # for features that are set to something else than 100%
+ feature.disable(target)
+ feature.enable(target)
+ end
else
feature.enable
end