Commit 7a828482 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'mr-stuck-checking-fix' into 'master'

Re-compile merge request Vue app after jQuery ajax

Closes gitlab-ce#27134

See merge request !1264
parents 1bda67b8 a9dd2edf
...@@ -150,6 +150,11 @@ require('./smart_interval'); ...@@ -150,6 +150,11 @@ require('./smart_interval');
$('.mr-widget-body').replaceWith($html.find('.mr-widget-body')); $('.mr-widget-body').replaceWith($html.find('.mr-widget-body'));
$('.mr-widget-footer').replaceWith($html.find('.mr-widget-footer')); $('.mr-widget-footer').replaceWith($html.find('.mr-widget-footer'));
$('.approvals-components').replaceWith($html.find('.approvals-components'));
if (gl.compileApprovalsWidget) {
gl.compileApprovalsWidget();
}
}); });
}; };
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
.on('click', '.js-rebase-button', () => { .on('click', '.js-rebase-button', () => {
$('.js-rebase-button').html("<i class='fa fa-spinner fa-spin'></i> Rebase in progress"); $('.js-rebase-button').html("<i class='fa fa-spinner fa-spin'></i> Rebase in progress");
}); });
} else if (!$('.mr-approvals-footer').length) { } else {
// getMergeStatus replaces the MR widget with new, updated HTML, which means any persistent // getMergeStatus replaces the MR widget with new, updated HTML, which means any persistent
// event management gets clobbered. When the MR is approvable, MR status is already managed // event management gets clobbered. When the MR is approvable, MR status is already managed
// and breaks when the DOM is clobbered. // and breaks when the DOM is clobbered.
......
...@@ -6,11 +6,22 @@ require('./approvals/approvals_bundle'); ...@@ -6,11 +6,22 @@ require('./approvals/approvals_bundle');
window.gl = window.gl || {}; window.gl = window.gl || {};
$(() => { $(() => {
let widgetSharedStore;
gl.compileApprovalsWidget = () => {
const rootEl = document.getElementById('merge-request-widget-app'); const rootEl = document.getElementById('merge-request-widget-app');
const widgetSharedStore = new gl.MergeRequestWidgetStore(rootEl);
if (gl.MergeRequestWidgetApp) {
gl.MergeRequestWidgetApp.$destroy();
} else {
widgetSharedStore = new gl.MergeRequestWidgetStore(rootEl);
}
gl.MergeRequestWidgetApp = new Vue({ gl.MergeRequestWidgetApp = new Vue({
el: rootEl, el: rootEl,
data: widgetSharedStore.data, data: widgetSharedStore.data,
}); });
};
gl.compileApprovalsWidget();
}); });
---
title: Fixed merge request state not updating when approvals feature is active
merge_request:
author:
...@@ -283,6 +283,28 @@ feature 'Merge request approvals', js: true, feature: true do ...@@ -283,6 +283,28 @@ feature 'Merge request approvals', js: true, feature: true do
end end
end end
end end
context 'when merge when discussions resolved is active', :js do
let(:project) do
create(:project,
approvals_before_merge: 1,
only_allow_merge_if_all_discussions_are_resolved: true)
end
before do
project.team << [user, :developer]
login_as(user)
visit new_namespace_project_merge_request_path(project.namespace, project, merge_request: { target_branch: 'master', source_branch: 'feature' })
click_button 'Submit merge request'
end
it 'does not show checking ability text' do
expect(find('.mr-widget-body')).not_to have_text('Checking ability to merge automatically')
expect(find('.mr-widget-body')).to have_selector('.accept-action')
end
end
end end
def approve_merge_request def approve_merge_request
......
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