diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-23 15:07:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-23 15:07:27 +0300 |
commit | 3e68d3848770b492d314f8e2967c37f7fdd5d143 (patch) | |
tree | 01bd69a759c55ddf4ea1e5549a253cb0fd564854 /app/assets/javascripts/invite_members | |
parent | 52192e0f19ca790dc9f44bc45730434100f83d90 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/invite_members')
-rw-r--r-- | app/assets/javascripts/invite_members/components/invite_members_modal.vue | 6 | ||||
-rw-r--r-- | app/assets/javascripts/invite_members/init_invite_members_modal.js | 73 |
2 files changed, 41 insertions, 38 deletions
diff --git a/app/assets/javascripts/invite_members/components/invite_members_modal.vue b/app/assets/javascripts/invite_members/components/invite_members_modal.vue index be48a58d838..da0c7860932 100644 --- a/app/assets/javascripts/invite_members/components/invite_members_modal.vue +++ b/app/assets/javascripts/invite_members/components/invite_members_modal.vue @@ -44,6 +44,10 @@ export default { type: String, required: true, }, + rootId: { + type: String, + required: true, + }, isProject: { type: Boolean, required: true, @@ -290,6 +294,8 @@ export default { :submit-disabled="inviteDisabled" :invalid-feedback-message="invalidFeedbackMessage" :is-loading="isLoading" + :new-users-to-invite="newUsersToInvite" + :root-group-id="rootId" @reset="resetFields" @submit="sendInvite" @access-level="onAccessLevelUpdate" diff --git a/app/assets/javascripts/invite_members/init_invite_members_modal.js b/app/assets/javascripts/invite_members/init_invite_members_modal.js index e9d620cedf0..cb05798bb9d 100644 --- a/app/assets/javascripts/invite_members/init_invite_members_modal.js +++ b/app/assets/javascripts/invite_members/init_invite_members_modal.js @@ -5,45 +5,42 @@ import { parseBoolean } from '~/lib/utils/common_utils'; Vue.use(GlToast); -let initedInviteMembersModal; +export default (function initInviteMembersModal() { + let inviteMembersModal; -export default function initInviteMembersModal() { - if (initedInviteMembersModal) { - // if we already loaded this in another part of the dom, we don't want to do it again - // else we will stack the modals - return false; - } + return () => { + if (!inviteMembersModal) { + // https://gitlab.com/gitlab-org/gitlab/-/issues/344955 + // bug lying in wait here for someone to put group and project invite in same screen + // once that happens we'll need to mount these differently, perhaps split + // group/project to each mount one, with many ways to open it. + const el = document.querySelector('.js-invite-members-modal'); - // https://gitlab.com/gitlab-org/gitlab/-/issues/344955 - // bug lying in wait here for someone to put group and project invite in same screen - // once that happens we'll need to mount these differently, perhaps split - // group/project to each mount one, with many ways to open it. - const el = document.querySelector('.js-invite-members-modal'); + if (!el) { + return false; + } - if (!el) { - return false; - } - - initedInviteMembersModal = true; - - return new Vue({ - el, - name: 'InviteMembersModalRoot', - provide: { - newProjectPath: el.dataset.newProjectPath, - }, - render: (createElement) => - createElement(InviteMembersModal, { - props: { - ...el.dataset, - isProject: parseBoolean(el.dataset.isProject), - accessLevels: JSON.parse(el.dataset.accessLevels), - defaultAccessLevel: parseInt(el.dataset.defaultAccessLevel, 10), - tasksToBeDoneOptions: JSON.parse(el.dataset.tasksToBeDoneOptions || '[]'), - projects: JSON.parse(el.dataset.projects || '[]'), - usersFilter: el.dataset.usersFilter, - filterId: parseInt(el.dataset.filterId, 10), + inviteMembersModal = new Vue({ + el, + name: 'InviteMembersModalRoot', + provide: { + newProjectPath: el.dataset.newProjectPath, }, - }), - }); -} + render: (createElement) => + createElement(InviteMembersModal, { + props: { + ...el.dataset, + isProject: parseBoolean(el.dataset.isProject), + accessLevels: JSON.parse(el.dataset.accessLevels), + defaultAccessLevel: parseInt(el.dataset.defaultAccessLevel, 10), + tasksToBeDoneOptions: JSON.parse(el.dataset.tasksToBeDoneOptions || '[]'), + projects: JSON.parse(el.dataset.projects || '[]'), + usersFilter: el.dataset.usersFilter, + filterId: parseInt(el.dataset.filterId, 10), + }, + }), + }); + } + return inviteMembersModal; + }; +})(); |