diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-26 18:36:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-26 18:36:39 +0300 |
commit | ee9fd5d06a5ad8fa2d8f0b59614af63eb1b732c3 (patch) | |
tree | 4a10df7aa7944e9fa5139df650f65419b3773ca6 /app | |
parent | 11657a33e97a26f699638ab26ef934c8298126b7 (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-ee
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 |