Commit f640aeaa authored by Lukas Eipert's avatar Lukas Eipert

Ensure that leave_url pages have Rails initialized

On these pages we need Rails initialized immediately in order to be able
to get the confirmation dialog toggled. As we defer initialization in
main.js, it might be too late.
parent 9bf50c5d
import { initRails } from '~/lib/utils/rails_ujs';
import { deprecatedCreateFlash as Flash } from '~/flash'; import { deprecatedCreateFlash as Flash } from '~/flash';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import { getParameterByName } from '~/lib/utils/common_utils'; import { getParameterByName } from '~/lib/utils/common_utils';
...@@ -11,6 +12,8 @@ export default function leaveByUrl(namespaceType) { ...@@ -11,6 +12,8 @@ export default function leaveByUrl(namespaceType) {
const param = getParameterByName(PARAMETER_NAME); const param = getParameterByName(PARAMETER_NAME);
if (!param) return; if (!param) return;
initRails();
const leaveLink = document.querySelector(LEAVE_LINK_SELECTOR); const leaveLink = document.querySelector(LEAVE_LINK_SELECTOR);
if (leaveLink) { if (leaveLink) {
leaveLink.click(); leaveLink.click();
......
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