Created
August 4, 2017 06:34
-
-
Save mariorodriguespt/dd3df12f6949b44460528967fd83552d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add this package meteor add matb33:collection-hooks | |
//Create a new file in /server/hooks.js | |
Meteor.startup(function(){ | |
Thread.models.Contacts.model.after.update((userId, doc) => { | |
console.log('doc: ' , doc); | |
Meteor.users.update({ | |
_id : doc.userId, | |
profile.userChangedName: false | |
},{ | |
$set:{ | |
"profile.firstName" : doc.firstName, | |
"profile.lastName": doc.lastName | |
} | |
}); | |
}); | |
}); | |
//server/lib/account.js | |
//Add this field to new user, we also need to migrate the current database | |
user.userChangedName = false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment