mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
set invitation information for newly signed up users based on existing invites
This commit is contained in:
parent
d2d4a0dd6b
commit
c25c6dd126
1 changed files with 19 additions and 1 deletions
|
@ -43,6 +43,25 @@ Accounts.onCreateUser(function(options, user){
|
|||
if(user.profile.email)
|
||||
addToMailChimpList(user);
|
||||
|
||||
// if the new user has been invited
|
||||
// set her status accordingly and update invitation info
|
||||
if(invitesEnabled() && user.profile.email){
|
||||
var invite = Invites.findOne({ invitedUserEmail : user.profile.email });
|
||||
if(invite){
|
||||
var invitedBy = Meteor.users.findOne({ _id : invite.invitingUserId });
|
||||
|
||||
user = _.extend(user, {
|
||||
isInvited: true,
|
||||
invitedBy: invitedBy._id,
|
||||
invitedByName: getDisplayName(invitedBy)
|
||||
});
|
||||
|
||||
Invites.update(invite._id, {$set : {
|
||||
accepted : true
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
||||
// send notifications to admins
|
||||
var admins = Meteor.users.find({isAdmin: true});
|
||||
admins.forEach(function(admin){
|
||||
|
@ -59,7 +78,6 @@ Accounts.onCreateUser(function(options, user){
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
return user;
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue