Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function updateInvite(invite, collaboration, done) {
  2.   var found = _.find(invite.collaborations, function(c) {
  3.     return c.project === collaboration.project
  4.   })
  5.   // There is already an outstanding invite to this user, just push these additional perms onto the collaborations
  6.   // list and send another email. We only push if they have not already been added to the invite.
  7.   if (!found) {
  8.     invite.update({$push:{collaborations: collaboration}}, function(err) {
  9.       if (err) return done(err)
  10.       // Invite updated, should probably send another email to recipient.
  11.       return done(null, false, false)
  12.     });
  13.   } else {
  14.     return done(null, false, true)
  15.   }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement