summaryrefslogtreecommitdiffstats
path: root/models/unsavedEdits.js
diff options
context:
space:
mode:
Diffstat (limited to 'models/unsavedEdits.js')
-rw-r--r--models/unsavedEdits.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/models/unsavedEdits.js b/models/unsavedEdits.js
index 87a70e22..25952fb5 100644
--- a/models/unsavedEdits.js
+++ b/models/unsavedEdits.js
@@ -14,6 +14,11 @@ UnsavedEditCollection.attachSchema(new SimpleSchema({
},
userId: {
type: String,
+ autoValue() { // eslint-disable-line consistent-return
+ if (this.isInsert && !this.isSet) {
+ return this.userId;
+ }
+ },
},
}));
@@ -28,7 +33,3 @@ if (Meteor.isServer) {
fetch: ['userId'],
});
}
-
-UnsavedEditCollection.before.insert((userId, doc) => {
- doc.userId = userId;
-});