Send invite email and notification in the background

This commit is contained in:
James Allen 2016-09-21 10:11:35 +01:00
parent c2e14ded13
commit a93c939dbc

View file

@ -77,10 +77,12 @@ module.exports = CollaboratorsInviteHandler =
if err? if err?
logger.err {err, projectId, sendingUserId: sendingUser._id, email}, "error saving token" logger.err {err, projectId, sendingUserId: sendingUser._id, email}, "error saving token"
return callback(err) return callback(err)
# Send email and notification in background
CollaboratorsInviteHandler._sendMessages projectId, sendingUser, invite, (err) -> CollaboratorsInviteHandler._sendMessages projectId, sendingUser, invite, (err) ->
if err? if err?
logger.err {projectId, email}, "error sending messages for invite" logger.err {projectId, email}, "error sending messages for invite"
callback(err, invite) callback(null, invite)
revokeInvite: (projectId, inviteId, callback=(err)->) -> revokeInvite: (projectId, inviteId, callback=(err)->) ->
logger.log {projectId, inviteId}, "removing invite" logger.log {projectId, inviteId}, "removing invite"