diff options
Diffstat (limited to 'models/users.js')
-rw-r--r-- | models/users.js | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/models/users.js b/models/users.js index cdc4d9dc..f944d7b1 100644 --- a/models/users.js +++ b/models/users.js @@ -373,24 +373,25 @@ if (Meteor.isServer) { board.addMember(user._id); user.addInvite(boardId); - try { - const params = { - user: user.username, - inviter: inviter.username, - board: board.title, - url: board.absoluteUrl(), - }; - const lang = user.getLanguage(); - Email.send({ - to: user.emails[0].address.toLowerCase(), - from: Accounts.emailTemplates.from, - subject: TAPi18n.__('email-invite-subject', params, lang), - text: TAPi18n.__('email-invite-text', params, lang), - }); - } catch (e) { - throw new Meteor.Error('email-fail', e.message); + if (Settings.findOne().mailUrl()) { + try { + const params = { + user: user.username, + inviter: inviter.username, + board: board.title, + url: board.absoluteUrl(), + }; + const lang = user.getLanguage(); + Email.send({ + to: user.emails[0].address.toLowerCase(), + from: Accounts.emailTemplates.from, + subject: TAPi18n.__('email-invite-subject', params, lang), + text: TAPi18n.__('email-invite-text', params, lang), + }); + } catch (e) { + throw new Meteor.Error('email-fail', e.message); + } } - return { username: user.username, email: user.emails[0].address }; }, }); @@ -510,4 +511,3 @@ if (Meteor.isServer) { } }); } - |