|
@@ -5,6 +5,9 @@ this.Documents = new Mongo.Collection("documents");
|
|
EditingUsers = new Mongo.Collection("editingUsers");
|
|
EditingUsers = new Mongo.Collection("editingUsers");
|
|
|
|
|
|
if (Meteor.isClient) {
|
|
if (Meteor.isClient) {
|
|
|
|
+ Meteor.subscribe("documents");
|
|
|
|
+ Meteor.subscribe("editingUsers");
|
|
|
|
+
|
|
Template.editor.helpers({
|
|
Template.editor.helpers({
|
|
|
|
|
|
docid: function () {
|
|
docid: function () {
|
|
@@ -113,6 +116,15 @@ if (Meteor.isClient) {
|
|
}
|
|
}
|
|
|
|
|
|
if (Meteor.isServer) {
|
|
if (Meteor.isServer) {
|
|
|
|
+ Meteor.publish("documents", function () {
|
|
|
|
+ Meteor._debug("Publishing documents");
|
|
|
|
+ return Documents.find({ isPrivate: false });
|
|
|
|
+ });
|
|
|
|
+ Meteor.publish("editingUsers", function () {
|
|
|
|
+ Meteor._debug("Publishing all editingUsers");
|
|
|
|
+ return EditingUsers.find();
|
|
|
|
+ });
|
|
|
|
+
|
|
Meteor.startup(function () {
|
|
Meteor.startup(function () {
|
|
|
|
|
|
if (!Documents.findOne()) {
|
|
if (!Documents.findOne()) {
|
|
@@ -145,7 +157,7 @@ Meteor.methods({
|
|
if (!this.userId) {
|
|
if (!this.userId) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- let res = Documents.update({ _id: doc._id, owner: this.userId }, { $set: { private: doc.isPrivate } });
|
|
+ let res = Documents.update({ _id: doc._id, owner: this.userId }, { $set: { isPrivate: doc.isPrivate } });
|
|
Meteor._debug("update", res);
|
|
Meteor._debug("update", res);
|
|
},
|
|
},
|
|
|
|
|