1.27.0 1.27.1
...@@ -806,7 +806,7 @@ ...@@ -806,7 +806,7 @@
.merge-request-tabs-holder { .merge-request-tabs-holder {
top: $header-height; top: $header-height;
z-index: 300; z-index: 250;
background-color: $white-light; background-color: $white-light;
border-bottom: 1px solid $border-color; border-bottom: 1px solid $border-color;
... ...
......
...@@ -4,7 +4,7 @@ class BroadcastMessage < ActiveRecord::Base ...@@ -4,7 +4,7 @@ class BroadcastMessage < ActiveRecord::Base
include CacheMarkdownField include CacheMarkdownField
include Sortable include Sortable
cache_markdown_field :message, pipeline: :broadcast_message cache_markdown_field :message, pipeline: :broadcast_message, whitelisted: true
validates :message, presence: true validates :message, presence: true
validates :starts_at, presence: true validates :starts_at, presence: true
... ...
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
# cache_markdown_field :foo # cache_markdown_field :foo
# cache_markdown_field :bar # cache_markdown_field :bar
# cache_markdown_field :baz, pipeline: :single_line # cache_markdown_field :baz, pipeline: :single_line
# cache_markdown_field :baz, whitelisted: true
# #
# Corresponding foo_html, bar_html and baz_html fields should exist. # Corresponding foo_html, bar_html and baz_html fields should exist.
module CacheMarkdownField module CacheMarkdownField
...@@ -39,6 +40,14 @@ module CacheMarkdownField ...@@ -39,6 +40,14 @@ module CacheMarkdownField
def html_fields def html_fields
markdown_fields.map { |field| html_field(field) } markdown_fields.map { |field| html_field(field) }
end end
def html_fields_whitelisted
markdown_fields.each_with_object([]) do |field, fields|
if @data[field].fetch(:whitelisted, false)
fields << html_field(field)
end
end
end
end end
def skip_project_check? def skip_project_check?
...@@ -149,13 +158,18 @@ module CacheMarkdownField ...@@ -149,13 +158,18 @@ module CacheMarkdownField
alias_method :attributes_before_markdown_cache, :attributes alias_method :attributes_before_markdown_cache, :attributes
def attributes def attributes
attrs = attributes_before_markdown_cache attrs = attributes_before_markdown_cache
html_fields = cached_markdown_fields.html_fields
whitelisted = cached_markdown_fields.html_fields_whitelisted
exclude_fields = html_fields - whitelisted
attrs.delete('cached_markdown_version') exclude_fields.each do |field|
cached_markdown_fields.html_fields.each do |field|
attrs.delete(field) attrs.delete(field)
end end
if whitelisted.empty?
attrs.delete('cached_markdown_version')
end
attrs attrs
end end
... ...
......
...@@ -1378,6 +1378,7 @@ class Project < ActiveRecord::Base ...@@ -1378,6 +1378,7 @@ class Project < ActiveRecord::Base
repository.raw_repository.write_ref('HEAD', "refs/heads/#{branch}") repository.raw_repository.write_ref('HEAD', "refs/heads/#{branch}")
repository.copy_gitattributes(branch) repository.copy_gitattributes(branch)
repository.after_change_head repository.after_change_head
ProjectCacheWorker.perform_async(self.id, [], [:commit_count])
reload_default_branch reload_default_branch
else else
errors.add(:base, "Could not change HEAD: branch '#{branch}' does not exist") errors.add(:base, "Could not change HEAD: branch '#{branch}' does not exist")
... ...
......
...@@ -57,7 +57,7 @@ class DiffFileEntity < DiffFileBaseEntity ...@@ -57,7 +57,7 @@ class DiffFileEntity < DiffFileBaseEntity
diff_file.diff_lines_for_serializer diff_file.diff_lines_for_serializer
end end
expose :is_fully_expanded, if: -> (diff_file, _) { Feature.enabled?(:expand_diff_full_file) && diff_file.text? } do |diff_file| expose :is_fully_expanded, if: -> (diff_file, _) { Feature.enabled?(:expand_diff_full_file, default_enabled: true) && diff_file.text? } do |diff_file|
diff_file.fully_expanded? diff_file.fully_expanded?
end end
... ...
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
%p %p
By default, protected branches are designed to: By default, protected branches are designed to:
%ul %ul
%li prevent their creation, if not already created, from everybody except users who are allowed to merge %li prevent their creation, if not already created, from everybody except Maintainers
%li prevent pushes from everybody except Maintainers %li prevent pushes from everybody except Maintainers
%li prevent <strong>anyone</strong> from force pushing to the branch %li prevent <strong>anyone</strong> from force pushing to the branch
%li prevent <strong>anyone</strong> from deleting the branch %li prevent <strong>anyone</strong> from deleting the branch
... ...
......
...@@ -27,6 +27,7 @@ class ProjectCacheWorker ...@@ -27,6 +27,7 @@ class ProjectCacheWorker
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
def update_statistics(project, statistics = []) def update_statistics(project, statistics = [])
return if Gitlab::Database.read_only?
return unless try_obtain_lease_for(project.id, :update_statistics) return unless try_obtain_lease_for(project.id, :update_statistics)
Rails.logger.info("Updating statistics for project #{project.id}") Rails.logger.info("Updating statistics for project #{project.id}")
... ...
......
---
title: Fix issue that caused the "Show all activity" button to appear on top of the
mini pipeline status dropdown on the merge request page
merge_request: 26274
author:
type: fixed
---
title: Fix duplicated bottom match line on merge request parallel diff view
merge_request: 26402
author:
type: fixed
---
title: Allow users who can push to protected branches to create protected branches
via CLI
merge_request: 26413
author:
type: fixed
---
title: Add missing .gitlab-ci.yml to Android template
merge_request: 26415
author:
type: fixed
---
title: Upgrade to Gitaly v1.27.1
merge_request: 26533
author:
type: changed
---
title: Refresh commit count after repository head changes
merge_request: 26473
author:
type: fixed
---
title: Set proper default-branch for repository on GitHub Import
merge_request: 26476
author:
type: fixed
---
title: 'GitHub importer: Use the project creator to create branches from forks'
merge_request: 26510
author:
type: fixed
...@@ -10,7 +10,7 @@ created protected branches. ...@@ -10,7 +10,7 @@ created protected branches.
By default, a protected branch does four simple things: By default, a protected branch does four simple things:
- it prevents its creation, if not already created, from everybody except users - it prevents its creation, if not already created, from everybody except users
who are allowed to merge with Maintainer permission
- it prevents pushes from everybody except users with Maintainer permission - it prevents pushes from everybody except users with Maintainer permission
- it prevents **anyone** from force pushing to the branch - it prevents **anyone** from force pushing to the branch
- it prevents **anyone** from deleting the branch - it prevents **anyone** from deleting the branch
... ...
......
...@@ -59,6 +59,8 @@ module Gitlab ...@@ -59,6 +59,8 @@ module Gitlab
def protected_branch_creation_checks def protected_branch_creation_checks
logger.log_timed(LOG_MESSAGES[:protected_branch_creation_checks]) do logger.log_timed(LOG_MESSAGES[:protected_branch_creation_checks]) do
break if user_access.can_push_to_branch?(branch_name)
unless user_access.can_merge_to_branch?(branch_name) unless user_access.can_merge_to_branch?(branch_name)
raise GitAccess::UnauthorizedError, ERROR_MESSAGES[:create_protected_branch] raise GitAccess::UnauthorizedError, ERROR_MESSAGES[:create_protected_branch]
end end
... ...
......
...@@ -158,7 +158,10 @@ module Gitlab ...@@ -158,7 +158,10 @@ module Gitlab
new_blob || old_blob new_blob || old_blob
end end
attr_writer :highlighted_diff_lines def highlighted_diff_lines=(value)
clear_memoization(:diff_lines_for_serializer)
@highlighted_diff_lines = value
end
# Array of Gitlab::Diff::Line objects # Array of Gitlab::Diff::Line objects
def diff_lines def diff_lines
...@@ -314,10 +317,11 @@ module Gitlab ...@@ -314,10 +317,11 @@ module Gitlab
# This adds the bottom match line to the array if needed. It contains # This adds the bottom match line to the array if needed. It contains
# the data to load more context lines. # the data to load more context lines.
def diff_lines_for_serializer def diff_lines_for_serializer
strong_memoize(:diff_lines_for_serializer) do
lines = highlighted_diff_lines lines = highlighted_diff_lines
return if lines.empty? next if lines.empty?
return if blob.nil? next if blob.nil?
last_line = lines.last last_line = lines.last
...@@ -328,6 +332,7 @@ module Gitlab ...@@ -328,6 +332,7 @@ module Gitlab
lines lines
end end
end
def fully_expanded? def fully_expanded?
return true if binary? return true if binary?
... ...
......
...@@ -89,7 +89,7 @@ module Gitlab ...@@ -89,7 +89,7 @@ module Gitlab
return if project.repository.branch_exists?(source_branch) return if project.repository.branch_exists?(source_branch)
project.repository.add_branch(project.owner, source_branch, pull_request.source_branch_sha) project.repository.add_branch(project.creator, source_branch, pull_request.source_branch_sha)
rescue Gitlab::Git::CommandError => e rescue Gitlab::Git::CommandError => e
Gitlab::Sentry.track_acceptable_exception(e, Gitlab::Sentry.track_acceptable_exception(e,
extra: { extra: {
... ...
......