Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mariorodriguespt/dd3df12f6949b44460528967fd83552d to your computer and use it in GitHub Desktop.
Save mariorodriguespt/dd3df12f6949b44460528967fd83552d to your computer and use it in GitHub Desktop.
//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