fix invitations and add missing tests

This commit is contained in:
Matteo Pagliazzi
2016-02-27 12:01:00 +01:00
parent 0014afb75e
commit b4e4e31be5
3 changed files with 31 additions and 5 deletions
+2 -3
View File
@@ -548,14 +548,13 @@ async function _inviteByEmail (invite, group, inviter, req, res) {
let variables = [
{name: 'LINK', content: link},
{name: 'INVITER', content: inviter.profile.name},
{name: 'INVITER', content: req.body.inviter || inviter.profile.name},
];
if (group.type === 'guild') {
variables.push({name: 'GUILD_NAME', content: group.name});
}
// TODO implement "users can only be invited once"
// Check for the email address not to be unsubscribed
let userIsUnsubscribed = await EmailUnsubscription.findOne({email: invite.email}).exec();
let groupLabel = group.type === 'guild' ? '-guild' : '';
@@ -598,7 +597,7 @@ api.inviteToGroup = {
let emails = req.body.emails;
let uuidsIsArray = Array.isArray(uuids);
let emailsIsArray = Array.isArray(emails);
let emailsIsArray = Array.isArray(emails);
if (!uuids && !emails) {
throw new BadRequest(res.t('canOnlyInviteEmailUuid'));