Commit 51fbdb3b authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 0de92c60 d5e8e1ef
......@@ -16,10 +16,10 @@
margin-top: 5px;
}
border-radius: 3px;
border-radius: $border-radius-default;
display: block;
float: left;
margin-right: 10px;
margin-right: $gl-padding-8;
color: $white-light;
font-size: $gl-font-size;
line-height: $gl-line-height-24;
......
......@@ -682,8 +682,7 @@
justify-content: center;
align-items: center;
margin-top: 0;
padding-left: 9px;
padding-right: 9px;
padding: 0 $gl-padding-8;
@include media-breakpoint-up(sm) {
display: inline-block;
......
......@@ -54,7 +54,7 @@ class ProjectStatistics < ApplicationRecord
end
def update_storage_size
self.storage_size = repository_size + wiki_size + lfs_objects_size + build_artifacts_size + packages_size
self.storage_size = repository_size + wiki_size.to_i + lfs_objects_size + build_artifacts_size + packages_size
end
# Since this incremental update method does not call update_storage_size above,
......
......@@ -68,6 +68,10 @@ module MergeRequests
!merge_request.for_fork?
end
def cancel_auto_merge(merge_request)
AutoMergeService.new(project, current_user).cancel(merge_request)
end
# Returns all origin and fork merge requests from `@project` satisfying passed arguments.
# rubocop: disable CodeReuse/ActiveRecord
def merge_requests_for(source_branch, mr_states: [:opened])
......
......@@ -34,9 +34,5 @@ module MergeRequests
merge_request_metrics_service(merge_request).close(close_event)
end
end
def cancel_auto_merge(merge_request)
AutoMergeService.new(project, current_user).cancel(merge_request)
end
end
end
......@@ -24,7 +24,7 @@ module MergeRequests
reload_merge_requests
outdate_suggestions
refresh_pipelines_on_merge_requests
cancel_auto_merge
cancel_auto_merges
mark_pending_todos_done
cache_merge_requests_closing_issues
......@@ -142,9 +142,9 @@ module MergeRequests
end
end
def cancel_auto_merge
def cancel_auto_merges
merge_requests_for_source_branch.each do |merge_request|
AutoMergeService.new(project, current_user).cancel(merge_request)
cancel_auto_merge(merge_request)
end
end
......
......@@ -43,6 +43,8 @@ module MergeRequests
create_branch_change_note(merge_request, 'target',
merge_request.previous_changes['target_branch'].first,
merge_request.target_branch)
cancel_auto_merge(merge_request)
end
if merge_request.assignees != old_assignees
......
---
title: Fix nil coercion updating storage size on project statistics
merge_request: 29425
author:
type: fixed
---
title: Cancel Auto Merge when target branch is changed
merge_request: 29416
author:
type: fixed
---
title: Use grid and correct border radius for status badge
merge_request:
author:
type: other
......@@ -197,6 +197,18 @@ describe ProjectStatistics do
expect(statistics.storage_size).to eq 9
end
it 'works during wiki_size backfill' do
statistics.update!(
repository_size: 2,
wiki_size: nil,
lfs_objects_size: 3
)
statistics.reload
expect(statistics.storage_size).to eq 5
end
end
describe '.increment_statistic' do
......
......@@ -406,6 +406,18 @@ describe MergeRequests::UpdateService, :mailer do
expect(pending_todo.reload).to be_done
end
end
context 'when auto merge is enabled and target branch changed' do
before do
AutoMergeService.new(project, user).execute(merge_request, AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS)
update_merge_request({ target_branch: 'target' })
end
it 'marks pending todos as done' do
expect(pending_todo.reload).to be_done
end
end
end
context 'when the merge request is relabeled' do
......
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