diff options
Diffstat (limited to 'app/assets/javascripts/invite_members/components/invite_members_modal.vue')
-rw-r--r-- | app/assets/javascripts/invite_members/components/invite_members_modal.vue | 69 |
1 files changed, 19 insertions, 50 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 cf4f434a7a8..91a139a5105 100644 --- a/app/assets/javascripts/invite_members/components/invite_members_modal.vue +++ b/app/assets/javascripts/invite_members/components/invite_members_modal.vue @@ -20,12 +20,11 @@ import { BV_SHOW_MODAL } from '~/lib/utils/constants'; import { getParameterValues } from '~/lib/utils/url_utility'; import { sprintf } from '~/locale'; import { - INVITE_MEMBERS_IN_COMMENT, GROUP_FILTERS, USERS_FILTER_ALL, - MEMBER_AREAS_OF_FOCUS, INVITE_MEMBERS_FOR_TASK, MODAL_LABELS, + LEARN_GITLAB, } from '../constants'; import eventHub from '../event_hub'; import { @@ -100,14 +99,6 @@ export default { type: String, required: true, }, - areasOfFocusOptions: { - type: Array, - required: true, - }, - noSelectionAreasOfFocus: { - type: Array, - required: true, - }, tasksToBeDoneOptions: { type: Array, required: true, @@ -125,7 +116,6 @@ export default { inviteeType: 'members', newUsersToInvite: [], selectedDate: undefined, - selectedAreasOfFocus: [], selectedTasksToBeDone: [], selectedTaskProject: this.projects[0], groupToBeSharedWith: {}, @@ -181,16 +171,6 @@ export default { this.newUsersToInvite.length === 0 && Object.keys(this.groupToBeSharedWith).length === 0 ); }, - areasOfFocusEnabled() { - return !this.tasksToBeDoneEnabled && this.areasOfFocusOptions.length !== 0; - }, - areasOfFocusForPost() { - if (this.selectedAreasOfFocus.length === 0 && this.areasOfFocusEnabled) { - return this.noSelectionAreasOfFocus; - } - - return this.selectedAreasOfFocus; - }, errorFieldDescription() { if (this.inviteeType === 'group') { return ''; @@ -200,7 +180,8 @@ export default { }, tasksToBeDoneEnabled() { return ( - getParameterValues('open_modal')[0] === 'invite_members_for_task' && + (getParameterValues('open_modal')[0] === 'invite_members_for_task' || + this.isOnLearnGitlab) && this.tasksToBeDoneOptions.length ); }, @@ -221,11 +202,16 @@ export default { ? this.selectedTaskProject.id : ''; }, + isOnLearnGitlab() { + return this.source === LEARN_GITLAB; + }, }, mounted() { eventHub.$on('openModal', (options) => { this.openModal(options); - this.trackEvent(MEMBER_AREAS_OF_FOCUS.name, MEMBER_AREAS_OF_FOCUS.view); + if (this.isOnLearnGitlab) { + this.trackEvent(INVITE_MEMBERS_FOR_TASK.name, this.source); + } }); if (this.tasksToBeDoneEnabled) { @@ -267,13 +253,6 @@ export default { this.submitInviteMembers(); } }, - trackInvite() { - if (this.source === INVITE_MEMBERS_IN_COMMENT) { - this.trackEvent(INVITE_MEMBERS_IN_COMMENT, 'comment_invite_success'); - } - - this.trackEvent(MEMBER_AREAS_OF_FOCUS.name, MEMBER_AREAS_OF_FOCUS.submit); - }, trackinviteMembersForTask() { const label = 'selected_tasks_to_be_done'; const property = this.selectedTasksToBeDone.join(','); @@ -287,7 +266,6 @@ export default { this.newUsersToInvite = []; this.groupToBeSharedWith = {}; this.invalidFeedbackMessage = ''; - this.selectedAreasOfFocus = []; this.selectedTasksToBeDone = []; [this.selectedTaskProject] = this.projects; }, @@ -303,7 +281,7 @@ export default { : Api.groupShareWithGroup.bind(Api); apiShareWithGroup(this.id, this.shareWithGroupPostData(this.groupToBeSharedWith.id)) - .then(this.showToastMessageSuccess) + .then(this.showSuccessMessage) .catch(this.showInvalidFeedbackMessage); }, submitInviteMembers() { @@ -328,11 +306,10 @@ export default { promises.push(apiAddByUserId(this.id, this.addByUserIdPostData(usersToAddById))); } - this.trackInvite(); this.trackinviteMembersForTask(); Promise.all(promises) - .then(this.conditionallyShowToastSuccess) + .then(this.conditionallyShowSuccessMessage) .catch(this.showInvalidFeedbackMessage); }, inviteByEmailPostData(usersToInviteByEmail) { @@ -341,7 +318,6 @@ export default { email: usersToInviteByEmail, access_level: this.selectedAccessLevel, invite_source: this.source, - areas_of_focus: this.areasOfFocusForPost, tasks_to_be_done: this.tasksToBeDoneForPost, tasks_project_id: this.tasksProjectForPost, }; @@ -352,7 +328,6 @@ export default { user_id: usersToAddById, access_level: this.selectedAccessLevel, invite_source: this.source, - areas_of_focus: this.areasOfFocusForPost, tasks_to_be_done: this.tasksToBeDoneForPost, tasks_project_id: this.tasksProjectForPost, }; @@ -364,11 +339,11 @@ export default { group_access: this.selectedAccessLevel, }; }, - conditionallyShowToastSuccess(response) { + conditionallyShowSuccessMessage(response) { const message = this.unescapeMsg(responseMessageFromSuccess(response)); if (message === '') { - this.showToastMessageSuccess(); + this.showSuccessMessage(); return; } @@ -376,8 +351,12 @@ export default { this.invalidFeedbackMessage = message; this.isLoading = false; }, - showToastMessageSuccess() { - this.$toast.show(this.$options.labels.toastMessageSuccessful, this.toastOptions); + showSuccessMessage() { + if (this.isOnLearnGitlab) { + eventHub.$emit('showSuccessfulInvitationsAlert'); + } else { + this.$toast.show(this.$options.labels.toastMessageSuccessful, this.toastOptions); + } this.closeModal(); }, showInvalidFeedbackMessage(response) { @@ -504,16 +483,6 @@ export default { </template> </gl-datepicker> </div> - <div v-if="areasOfFocusEnabled"> - <label class="gl-mt-5"> - {{ $options.labels.areasOfFocusLabel }} - </label> - <gl-form-checkbox-group - v-model="selectedAreasOfFocus" - :options="areasOfFocusOptions" - data-testid="area-of-focus-checks" - /> - </div> <div v-if="showTasksToBeDone" data-testid="invite-members-modal-tasks-to-be-done"> <label class="gl-mt-5"> {{ $options.labels.members.tasksToBeDone.title }} |