From 6edb7e9bb152d919c215f35bd6cb7d52fd3d99be Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 8 Nov 2021 10:33:01 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-4-stable-ee --- app/assets/stylesheets/page_bundles/boards.scss | 2 +- app/models/legacy_diff_note.rb | 6 +++++- app/models/protected_branch.rb | 7 ++++++- app/views/shared/boards/_show.html.haml | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/page_bundles/boards.scss b/app/assets/stylesheets/page_bundles/boards.scss index 4806f4b054b..a3ec2167b13 100644 --- a/app/assets/stylesheets/page_bundles/boards.scss +++ b/app/assets/stylesheets/page_bundles/boards.scss @@ -430,7 +430,7 @@ height: $input-height; } -.issue-boards-content { +.issue-boards-content:not(.breadcrumbs) { isolation: isolate; } diff --git a/app/models/legacy_diff_note.rb b/app/models/legacy_diff_note.rb index 25e90036a53..ede20578850 100644 --- a/app/models/legacy_diff_note.rb +++ b/app/models/legacy_diff_note.rb @@ -13,7 +13,7 @@ class LegacyDiffNote < Note validates :line_code, presence: true, line_code: true - before_create :set_diff + before_create :set_diff, unless: :skip_setting_st_diff? def discussion_class(*) LegacyDiffDiscussion @@ -90,6 +90,10 @@ class LegacyDiffNote < Note self.st_diff = diff.to_hash if diff end + def skip_setting_st_diff? + st_diff.present? && importing? + end + def diff_for_line_code attributes = { noteable_type: noteable_type, diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index b4e2d17c3e5..96002c8668a 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -27,12 +27,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 diff --git a/app/views/shared/boards/_show.html.haml b/app/views/shared/boards/_show.html.haml index 165564c5666..98752345074 100644 --- a/app/views/shared/boards/_show.html.haml +++ b/app/views/shared/boards/_show.html.haml @@ -2,7 +2,7 @@ - @no_breadcrumb_container = true - @no_container = true - @content_wrapper_class = "#{@content_wrapper_class} gl-relative" -- @content_class = "js-focus-mode-board" +- @content_class = "issue-boards-content js-focus-mode-board" - is_epic_board = board.to_type == "EpicBoard" - if is_epic_board - breadcrumb_title _("Epic Boards") -- cgit v1.2.3