Commit 0249cf49 authored by Bryce Johnson's avatar Bryce Johnson

Disable rebase until merge request has been approved.

parent 425685c8
- content_for :page_specific_javascripts do - content_for :page_specific_javascripts do
= page_specific_javascript_tag('merge_request_widget/ci_bundle.js') = page_specific_javascript_tag('merge_request_widget/ci_bundle.js')
- approval_pending = @merge_request.requires_approve? && !@merge_request.approved?
- if @merge_request.rebase_in_progress? || (defined?(rebase_in_progress) && rebase_in_progress) - if @merge_request.rebase_in_progress? || (defined?(rebase_in_progress) && rebase_in_progress)
%h4.rebase-in-progress %h4.rebase-in-progress
= icon("spinner spin") = icon("spinner spin")
...@@ -21,7 +23,9 @@ ...@@ -21,7 +23,9 @@
= hidden_field_tag :authenticity_token, form_authenticity_token = hidden_field_tag :authenticity_token, form_authenticity_token
.accept-merge-holder.clearfix.js-toggle-container .accept-merge-holder.clearfix.js-toggle-container
.accept-action .accept-action
= f.button class: "btn btn-reopen js-rebase-button" do = f.button class: "btn btn-reopen js-rebase-button", disabled: approval_pending, ":disabled" => "disableAcceptance" do
Rebase onto #{@merge_request.target_branch} Rebase onto #{@merge_request.target_branch}
.accept-control .accept-control
Fast-forward merge is not possible. Rebase the source branch onto the target branch or merge target branch into source branch to allow this merge request to be merged. Fast-forward merge is not possible. Rebase the source branch onto the target branch or merge target branch into source branch to allow this merge request to be merged.
- if @merge_request.requires_approve?
%b{ "v-show" => "disableAcceptance" } (Rebasing is disabled until merge request has been approved)
...@@ -256,6 +256,32 @@ feature 'Merge request approvals', js: true, feature: true do ...@@ -256,6 +256,32 @@ feature 'Merge request approvals', js: true, feature: true do
expect(page).to have_button('Merge When Pipeline Succeeds', disabled: true) expect(page).to have_button('Merge When Pipeline Succeeds', disabled: true)
end end
end end
context 'when rebase is needed but no approval given', js: true do
let(:project) do
create(:project,
approvals_before_merge: 1,
merge_requests_rebase_enabled: true,
merge_requests_ff_only_enabled: true )
end
let(:merge_request) { create(:merge_request, source_project: project, source_branch: 'feature', target_branch: 'wip' ) }
before do
create :approver_group, group: group, target: merge_request
visit namespace_project_merge_request_path(project.namespace, project, merge_request)
end
it 'I am unable to rebase the merge request' do
# before approval status is loaded
expect(page).to have_button('Rebase onto wip', disabled: true)
wait_for_ajax
# after approval status is loaded
expect(page).to have_button('Rebase onto wip', disabled: true)
end
end
end end
end end
......
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