diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 18:10:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 18:10:19 +0300 |
commit | bf0d6692fc4c16205cc49b8b87b7b7e0daa97c63 (patch) | |
tree | d44cb105682b2b39318c01a37f201b278b474663 /app/assets/javascripts/invite_members | |
parent | 9796aa22cd601f03101402540f41a05ad71828e5 (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 | 29 | ||||
-rw-r--r-- | app/assets/javascripts/invite_members/constants.js | 2 |
2 files changed, 23 insertions, 8 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..a6e747c6b48 100644 --- a/app/assets/javascripts/invite_members/components/invite_members_modal.vue +++ b/app/assets/javascripts/invite_members/components/invite_members_modal.vue @@ -26,6 +26,7 @@ import { MEMBER_AREAS_OF_FOCUS, INVITE_MEMBERS_FOR_TASK, MODAL_LABELS, + LEARN_GITLAB, } from '../constants'; import eventHub from '../event_hub'; import { @@ -200,7 +201,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 +223,18 @@ 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); + } else { + this.trackEvent(MEMBER_AREAS_OF_FOCUS.name, MEMBER_AREAS_OF_FOCUS.view); + } }); if (this.tasksToBeDoneEnabled) { @@ -303,7 +312,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() { @@ -332,7 +341,7 @@ export default { this.trackinviteMembersForTask(); Promise.all(promises) - .then(this.conditionallyShowToastSuccess) + .then(this.conditionallyShowSuccessMessage) .catch(this.showInvalidFeedbackMessage); }, inviteByEmailPostData(usersToInviteByEmail) { @@ -364,11 +373,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 +385,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) { diff --git a/app/assets/javascripts/invite_members/constants.js b/app/assets/javascripts/invite_members/constants.js index 59d4c2f3077..2a4e7041ed1 100644 --- a/app/assets/javascripts/invite_members/constants.js +++ b/app/assets/javascripts/invite_members/constants.js @@ -144,3 +144,5 @@ export const MODAL_LABELS = { headerCloseLabel: HEADER_CLOSE_LABEL, areasOfFocusLabel: AREAS_OF_FOCUS_LABEL, }; + +export const LEARN_GITLAB = 'learn_gitlab'; |