Commit 87cbd45b authored by Sean McGivern's avatar Sean McGivern

Merge branch '28176_merge_widget_fix' into 'master'

Fix error in MR widget after /merge slash command

Closes #28176

See merge request !9259
parents b0d78400 d89f4d73
...@@ -369,10 +369,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -369,10 +369,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
def merge_widget_refresh def merge_widget_refresh
if merge_request.in_progress_merge_commit_sha || merge_request.state == 'merged' if merge_request.merge_when_build_succeeds
@status = :success
elsif merge_request.merge_when_build_succeeds
@status = :merge_when_build_succeeds @status = :merge_when_build_succeeds
else
# Only MRs that can be merged end in this action
# MR can be already picked up for merge / merged already or can be waiting for worker to be picked up
# in last case it does not have any special status. Possible error is handled inside widget js function
@status = :success
end end
render 'merge' render 'merge'
......
---
title: Fix error in MR widget after /merge slash command
merge_request: 9259
author:
...@@ -1143,15 +1143,15 @@ describe Projects::MergeRequestsController do ...@@ -1143,15 +1143,15 @@ describe Projects::MergeRequestsController do
end end
end end
context 'when no special status for MR' do context 'when MR does not have special state' do
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
it 'returns an OK response' do it 'returns an OK response' do
expect(response).to have_http_status(:ok) expect(response).to have_http_status(:ok)
end end
it 'sets status to nil' do it 'sets status to success' do
expect(assigns(:status)).to be_nil expect(assigns(:status)).to eq(:success)
expect(response).to render_template('merge') expect(response).to render_template('merge')
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