mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
add note link to issue in collection2 on mutation insert, remove debug console logs on mutation edit
This commit is contained in:
parent
e894c3224c
commit
7a15103de7
1 changed files with 4 additions and 5 deletions
|
@ -71,7 +71,9 @@ export const newMutation = ({ collection, document, currentUser, validate, conte
|
|||
document = runCallbacks(`${collectionName}.new.sync`, document, currentUser);
|
||||
|
||||
// add _id to document
|
||||
document._id = collection.insert({...document}); // use {...document} to "enable" Object.prototype (see https://cl.ly/1N1m2d0y3u1A)
|
||||
// note: use {...document} to "enable" Object.prototype (see https://cl.ly/1N1m2d0y3u1A)
|
||||
// see https://github.com/aldeed/meteor-collection2-core/issues/8
|
||||
document._id = collection.insert({...document});
|
||||
|
||||
// get fresh copy of document from db
|
||||
const newDocument = collection.findOne(document._id);
|
||||
|
@ -108,14 +110,11 @@ export const editMutation = ({ collection, documentId, set, unset, currentUser,
|
|||
// check that the current user has permission to edit each field
|
||||
const modifiedProperties = _.keys(set).concat(_.keys(unset));
|
||||
modifiedProperties.forEach(function (fieldName) {
|
||||
var field = schema[fieldName];
|
||||
console.log(field);
|
||||
const field = schema[fieldName];
|
||||
if (!context.Users.canEditField(currentUser, field, document)) {
|
||||
throw new Meteor.Error('disallowed_property', `disallowed_property_detected: ${fieldName}`);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(modifier);
|
||||
|
||||
// validate modifier against schema
|
||||
collection.simpleSchema().namedContext(`${collectionName}.edit`).validate(modifier, {modifier: true});
|
||||
|
|
Loading…
Add table
Reference in a new issue