Commit a648bcad authored by Alexis Reigel's avatar Alexis Reigel

extract protected variable logic to helper

parent ccecf436
# frozen_string_literal: true
module CiVariablesHelper
def ci_variable_protected_by_default?
Gitlab::CurrentSettings.current_application_settings.protected_ci_variables
end
def ci_variable_protected?(variable, only_key_value)
if variable && !only_key_value
variable.protected
else
ci_variable_protected_by_default?
end
end
end
......@@ -5,8 +5,8 @@
- id = variable&.id
- key = variable&.key
- value = variable&.value
- is_protected_default = Gitlab::CurrentSettings.current_application_settings.protected_ci_variables
- is_protected = variable && !only_key_value ? variable.protected : is_protected_default
- is_protected_default = ci_variable_protected_by_default?
- is_protected = ci_variable_protected?(variable, only_key_value)
- id_input_name = "#{form_field}[variables_attributes][][id]"
- destroy_input_name = "#{form_field}[variables_attributes][][_destroy]"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment