Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-19 21:10:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-19 21:10:17 +0300
commitf5e42f97372d5bfe06291698d25e0f9e68b61819 (patch)
tree4b6e8dcd1ad901dfc2d1ae2252f6a5623e32d44e /app/assets/javascripts/invite_members
parent4c083c816333ef903fe7c32f412eaa53d7b959d3 (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.vue31
-rw-r--r--app/assets/javascripts/invite_members/constants.js4
2 files changed, 32 insertions, 3 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 87f1ed31a7f..a334f5e4bf7 100644
--- a/app/assets/javascripts/invite_members/components/invite_members_modal.vue
+++ b/app/assets/javascripts/invite_members/components/invite_members_modal.vue
@@ -118,6 +118,7 @@ export default {
selectedAccessLevel: undefined,
errorsLimit: 2,
isErrorsSectionExpanded: false,
+ emptyInvitesError: false,
};
},
computed: {
@@ -133,8 +134,8 @@ export default {
labelIntroText() {
return this.$options.labels[this.inviteTo][this.mode].introText;
},
- inviteDisabled() {
- return this.newUsersToInvite.length === 0;
+ isEmptyInvites() {
+ return Boolean(this.newUsersToInvite.length);
},
hasInvalidMembers() {
return !isEmpty(this.invalidMembers);
@@ -219,6 +220,18 @@ export default {
});
},
},
+ watch: {
+ isEmptyInvites: {
+ handler(updatedValue) {
+ // nothing to do if the invites are **still** empty and the emptyInvites were never set from submit
+ if (!updatedValue && !this.emptyInvitesError) {
+ return;
+ }
+
+ this.clearEmptyInviteError();
+ },
+ },
+ },
mounted() {
eventHub.$on('openModal', (options) => {
this.openModal(options);
@@ -260,10 +273,19 @@ export default {
const tracking = new ExperimentTracking(experimentName);
tracking.event(eventName);
},
+ showEmptyInvitesError() {
+ this.invalidFeedbackMessage = this.$options.labels.emptyInvitesErrorText;
+ this.emptyInvitesError = true;
+ },
sendInvite({ accessLevel, expiresAt }) {
this.isLoading = true;
this.clearValidation();
+ if (!this.isEmptyInvites) {
+ this.showEmptyInvitesError();
+ return;
+ }
+
const [usersToInviteByEmail, usersToAddById] = this.partitionNewUsersToInvite();
const apiAddByInvite = this.isProject
@@ -338,6 +360,10 @@ export default {
this.invalidFeedbackMessage = '';
this.invalidMembers = {};
},
+ clearEmptyInviteError() {
+ this.invalidFeedbackMessage = '';
+ this.emptyInvitesError = false;
+ },
removeToken(token) {
delete this.invalidMembers[memberName(token)];
this.invalidMembers = { ...this.invalidMembers };
@@ -360,7 +386,6 @@ export default {
:label-intro-text="labelIntroText"
:label-search-field="$options.labels.searchField"
:form-group-description="formGroupDescription"
- :submit-disabled="inviteDisabled"
:invalid-feedback-message="invalidFeedbackMessage"
:is-loading="isLoading"
:new-users-to-invite="newUsersToInvite"
diff --git a/app/assets/javascripts/invite_members/constants.js b/app/assets/javascripts/invite_members/constants.js
index 288c2bb9829..f502e1ea369 100644
--- a/app/assets/javascripts/invite_members/constants.js
+++ b/app/assets/javascripts/invite_members/constants.js
@@ -81,6 +81,9 @@ export const MEMBER_ERROR_LIST_TEXT = s__(
);
export const COLLAPSED_ERRORS = s__('InviteMembersModal|Show more (%{count})');
export const EXPANDED_ERRORS = s__('InviteMembersModal|Show less');
+export const EMPTY_INVITES_ERROR_TEXT = s__(
+ 'InviteMembersModal|Please select members or type email addresses to invite',
+);
export const MEMBER_MODAL_LABELS = {
modal: {
@@ -119,6 +122,7 @@ export const MEMBER_MODAL_LABELS = {
memberErrorListText: MEMBER_ERROR_LIST_TEXT,
collapsedErrors: COLLAPSED_ERRORS,
expandedErrors: EXPANDED_ERRORS,
+ emptyInvitesErrorText: EMPTY_INVITES_ERROR_TEXT,
};
export const GROUP_MODAL_LABELS = {