diff --git a/website/client/components/groups/inviteModalOld.vue b/website/client/components/groups/inviteModalOld.vue
deleted file mode 100644
index 8d8869f00d..0000000000
--- a/website/client/components/groups/inviteModalOld.vue
+++ /dev/null
@@ -1,152 +0,0 @@
-
-b-modal#invite-modal(:title="$t('inviteFriends')", size='lg')
- .modal-body
- p.alert.alert-info(v-html="$t('inviteAlertInfo')")
- .form-horizontal
- table.table.table-striped
- thead
- tr
- th {{ $t('userId') }}
- tbody
- tr(v-for='user in invitees')
- td
- input.form-control(type='text', v-model='user.uuid')
- tr
- td
- button.btn.btn-primary.pull-right(@click='addUuid()')
- i.glyphicon.glyphicon-plus
- | +
- tr
- td
- .col-6.col-offset-6
- button.btn.btn-primary.btn-block(@click='inviteNewUsers("uuid")') {{sendInviteText}}
- hr
- p.alert.alert-info {{ $t('inviteByEmail') }}
- .form-horizontal
- table.table.table-striped
- thead
- tr
- th {{ $t('name') }}
- th {{ $t('email') }}
- tbody
- tr(v-for='email in emails')
- td
- input.form-control(type='text', v-model='email.name')
- td
- input.form-control(type='email', v-model='email.email')
- tr
- td(colspan=2)
- button.btn.btn-primary.pull-right(@click='addEmail()')
- i.glyphicon.glyphicon-plus
- | +
- tr
- td.form-group(colspan=2)
- label.col-sm-1.control-label {{ $t('byColon') }}
- .col-sm-5
- input.form-control(type='text', v-model='inviter')
- .col-sm-6
- button.btn.btn-primary.btn-block(@click='inviteNewUsers("email")') {{sendInviteText}}
-
-
-
diff --git a/website/client/store/actions/guilds.js b/website/client/store/actions/guilds.js
index 3f2599850d..ea4e680440 100644
--- a/website/client/store/actions/guilds.js
+++ b/website/client/store/actions/guilds.js
@@ -164,6 +164,7 @@ export async function invite (store, payload) {
let response = await axios.post(`/api/v4/groups/${payload.groupId}/invite`, {
uuids: payload.invitationDetails.uuids,
emails: payload.invitationDetails.emails,
+ usernames: payload.invitationDetails.usernames,
});
// @TODO: find guild and add invites
diff --git a/website/common/locales/en/groups.json b/website/common/locales/en/groups.json
index e38e5543f9..876b4e1886 100644
--- a/website/common/locales/en/groups.json
+++ b/website/common/locales/en/groups.json
@@ -229,7 +229,7 @@
"memberCannotRemoveYourself": "You cannot remove yourself!",
"groupMemberNotFound": "User not found among group's members",
"mustBeGroupMember": "Must be member of the group.",
- "canOnlyInviteEmailUuid": "Can only invite using uuids or emails.",
+ "canOnlyInviteEmailUuid": "Can only invite using user IDs, emails, or usernames.",
"inviteMissingEmail": "Missing email address in invite.",
"inviteMissingUuid": "Missing user id in invite",
"inviteMustNotBeEmpty": "Invite must not be empty.",
@@ -245,6 +245,7 @@
"userHasNoLocalRegistration": "User does not have a local registration (username, email, password).",
"uuidsMustBeAnArray": "User ID invites must be an array.",
"emailsMustBeAnArray": "Email address invites must be an array.",
+ "usernamesMustBeAnArray": "Username invites must be an array.",
"canOnlyInviteMaxInvites": "You can only invite \"<%= maxInvites %>\" at a time",
"partyExceedsMembersLimit": "Party size is limited to <%= maxMembersParty %> members",
"onlyCreatorOrAdminCanDeleteChat": "Not authorized to delete this message!",
diff --git a/website/server/middlewares/errorHandler.js b/website/server/middlewares/errorHandler.js
index 429f8251a0..5b3cdb7390 100644
--- a/website/server/middlewares/errorHandler.js
+++ b/website/server/middlewares/errorHandler.js
@@ -16,7 +16,7 @@ module.exports = function errorHandler (err, req, res, next) { // eslint-disable
// Otherwise try to identify the type of error (mongoose validation, mongodb unique, ...)
// If we can't identify it, respond with a generic 500 error
let responseErr = err instanceof CustomError ? err : null;
- console.log(err)
+
// Handle errors created with 'http-errors' or similar that have a status/statusCode property
if (err.statusCode && typeof err.statusCode === 'number') {
responseErr = new CustomError();
diff --git a/website/server/models/group.js b/website/server/models/group.js
index 162b38d20f..42eb35c9a4 100644
--- a/website/server/models/group.js
+++ b/website/server/models/group.js
@@ -350,7 +350,7 @@ schema.statics.toJSONCleanChat = async function groupToJSONCleanChat (group, use
return toJSON;
};
-function getIniviteError (uuids, emails, usernames) {
+function getInviteError (uuids, emails, usernames) {
const uuidsIsArray = Array.isArray(uuids);
const emailsIsArray = Array.isArray(emails);
const usernamesIsArray = Array.isArray(usernames);
@@ -366,16 +366,12 @@ function getIniviteError (uuids, emails, usernames) {
errorString = 'uuidsMustBeAnArray';
} else if (emails && !emailsIsArray) {
errorString = 'emailsMustBeAnArray';
- } else if (!emails && emptyUuids) {
- errorString = 'inviteMissingUuid';
- } else if (!uuids && emptyEmails) {
- errorString = 'inviteMissingEmail';
- } else if (emptyEmails && emptyUuids) {
+ } else if (usernames && !usernamesIsArray) {
+ errorString = 'usernamesMustBeAnArray';
+ } else if (emptyEmails && emptyUuids && emptyUsernames) {
errorString = 'inviteMustNotBeEmpty';
}
- if (usernames && emptyUsernames) errorString = 'usernamesMustNotBeEmpty';
-
return errorString;
}
@@ -407,8 +403,7 @@ schema.statics.validateInvitations = async function getInvitationError (invites,
emails,
usernames,
} = invites;
-
- const errorString = getIniviteError(uuids, emails, usernames);
+ const errorString = getInviteError(uuids, emails, usernames);
if (errorString) throw new BadRequest(res.t(errorString));
const totalInvites = getInviteCount(uuids, emails);