Commit 514fde71 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch '2618-actionview-template-error-undefined-method-any-for-nil-nilclass' into 'master'

Resolve "ActionView::Template::Error: undefined method `any?' for nil:NilClass"

Closes #2618

See merge request !2090
parents fe6a0fbe 77b59525
......@@ -311,6 +311,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
rescue ActiveRecord::StaleObjectError
set_suggested_approvers if request.format.html?
render_conflict_response
end
......
---
title: Fix 500 error when approvals are enabled and editing an MR conflicts with another
edit
merge_request:
author:
......@@ -461,6 +461,12 @@ describe Projects::MergeRequestsController do
it_behaves_like 'update invalid issuable', MergeRequest
end
context 'when the merge request requires approval' do
before { project.update_attributes(approvals_before_merge: 1) }
it_behaves_like 'update invalid issuable', MergeRequest
end
context 'the approvals_before_merge param' do
before { project.update_attributes(approvals_before_merge: 2) }
......
......@@ -30,6 +30,10 @@ shared_examples 'update invalid issuable' do |klass|
expect(response).to render_template(:edit)
expect(assigns[:conflict]).to be_truthy
if klass == MergeRequest && issuable.requires_approve?
expect(assigns[:suggested_approvers]).to be_an(Array)
end
end
it 'renders json error message when format is json' 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