Skip to content

Instantly share code, notes, and snippets.

@mmoyles87
Created July 1, 2015 02:31
Show Gist options
  • Save mmoyles87/616199f9d5f0d5e91293 to your computer and use it in GitHub Desktop.
Save mmoyles87/616199f9d5f0d5e91293 to your computer and use it in GitHub Desktop.
# Merge user emails into emails array
Accounts.onLogin ->
Meteor.call('syncServiceEmails')
Meteor.methods
syncServiceEmails: ->
user = Meteor.user()
if user
_.each user.services, (service, serviceName) ->
if service.email
Meteor.users.update { _id: Meteor.userId() }, { $addToSet: 'emails': service.email }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment