diff options
Diffstat (limited to 'collections/unsavedEdits.js')
-rw-r--r-- | collections/unsavedEdits.js | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/collections/unsavedEdits.js b/collections/unsavedEdits.js deleted file mode 100644 index 87a70e22..00000000 --- a/collections/unsavedEdits.js +++ /dev/null @@ -1,34 +0,0 @@ -// This collection shouldn't be manipulated directly by instead throw the -// `UnsavedEdits` API on the client. -UnsavedEditCollection = new Mongo.Collection('unsaved-edits'); - -UnsavedEditCollection.attachSchema(new SimpleSchema({ - fieldName: { - type: String, - }, - docId: { - type: String, - }, - value: { - type: String, - }, - userId: { - type: String, - }, -})); - -if (Meteor.isServer) { - function isAuthor(userId, doc, fieldNames = []) { - return userId === doc.userId && fieldNames.indexOf('userId') === -1; - } - UnsavedEditCollection.allow({ - insert: isAuthor, - update: isAuthor, - remove: isAuthor, - fetch: ['userId'], - }); -} - -UnsavedEditCollection.before.insert((userId, doc) => { - doc.userId = userId; -}); |