diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/cycle_analytics/components/filter_bar.vue | 1 | ||||
-rw-r--r-- | app/models/protected_branch.rb | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/app/assets/javascripts/cycle_analytics/components/filter_bar.vue b/app/assets/javascripts/cycle_analytics/components/filter_bar.vue index 5140b05e189..016fea354fe 100644 --- a/app/assets/javascripts/cycle_analytics/components/filter_bar.vue +++ b/app/assets/javascripts/cycle_analytics/components/filter_bar.vue @@ -79,7 +79,6 @@ export default { title: __('Assignees'), type: 'assignees', token: AuthorToken, - defaultAuthors: [], initialAuthors: this.assigneesData, unique: false, operators: OPERATOR_IS_ONLY, diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index 3d32144e0f8..49f73788c44 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -25,12 +25,17 @@ class ProtectedBranch < ApplicationRecord # Check if branch name is marked as protected in the system def self.protected?(project, ref_name) return true if project.empty_repo? && project.default_branch_protected? + return false if ref_name.blank? - Rails.cache.fetch("protected_ref-#{ref_name}-#{project.cache_key}") do + Rails.cache.fetch(protected_ref_cache_key(project, ref_name)) do self.matching(ref_name, protected_refs: protected_refs(project)).present? end end + def self.protected_ref_cache_key(project, ref_name) + "protected_ref-#{project.cache_key}-#{Digest::SHA1.hexdigest(ref_name)}" + end + def self.allow_force_push?(project, ref_name) project.protected_branches.allowing_force_push.matching(ref_name).any? end |