Commit 479fa989 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Submit form when change is confirmed

Manually submit the form using JS after
we confirm the visibility change.
parent 9002c838
......@@ -790,12 +790,9 @@ export default {
button-variant="confirm"
:disabled="false"
:phrase="confirmationPhrase"
:confirm-danger-message="confirmDangerMessage"
:additional-information="additionalInformation"
:button-text="$options.i18n.confirmButtonText"
@confirm="$emit('confirm')"
/>
<!-- confirmDangerMessage -->
<gl-button
v-else
type="submit"
......
......@@ -7,12 +7,12 @@ export default function initProjectPermissionsSettings() {
const componentProps = JSON.parse(componentPropsEl.innerHTML);
const {
targetFormId,
additionalInformation,
confirmDangerMessage,
confirmButtonText,
phrase: confirmationPhrase,
} = mountPoint.dataset;
console.log('mountPoint', mountPoint.dataset);
return new Vue({
el: mountPoint,
......@@ -28,6 +28,11 @@ export default function initProjectPermissionsSettings() {
...componentProps,
confirmationPhrase,
},
on: {
confirm: () => {
if (targetFormId) document.getElementById(targetFormId)?.submit();
},
},
}),
});
}
......@@ -672,13 +672,10 @@ module ProjectsHelper
html_escape(message) % { strong_start: strong_start, strong_end: strong_end, project_name: project.name, group_name: project.group ? project.group.name : nil }
end
def visibility_confirm_modal_data(project, remove_form_id = nil)
def visibility_confirm_modal_data(project, target_form_id = nil)
{
remove_form_id: remove_form_id,
qa_selector: 'visibility_features_permissions_save_button',
button_text: _('Save changes'),
target_form_id: target_form_id,
button_testid: 'reduce-project-visibility-button',
button_variant: 'confirm',
confirm_button_text: _('Reduce project visibility'),
confirm_danger_message: confirm_reduce_visibility_message(project),
phrase: project.full_path,
......
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