mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
ensure apply only on server
This commit is contained in:
@@ -187,9 +187,10 @@ CollectionPrototype._defineMutationMethods = function(options) {
|
||||
}
|
||||
|
||||
const syncMethodName = method.replace('Async', '');
|
||||
// it forces to use async validated method as part of the method
|
||||
const validatedMethodName =
|
||||
'_validated' + method.charAt(0).toUpperCase() + syncMethodName.slice(1) + 'Async';
|
||||
const syncValidatedMethodName = '_validated' + method.charAt(0).toUpperCase() + syncMethodName.slice(1);
|
||||
// it forces to use async validated behavior on the server
|
||||
const validatedMethodName = Meteor.isServer ? syncValidatedMethodName + 'Async' : syncValidatedMethodName;
|
||||
|
||||
args.unshift(this.userId);
|
||||
isInsert(method) && args.push(generatedId);
|
||||
return self[validatedMethodName].apply(self, args);
|
||||
|
||||
Reference in New Issue
Block a user