Procházet zdrojové kódy

W3.8: removed autopublish, setup publish/subscribe.

Frederic G. MARAND před 8 roky
rodič
revize
47607d57b9
3 změnil soubory, kde provedl 13 přidání a 3 odebrání
  1. 0 1
      .meteor/packages
  2. 0 1
      .meteor/versions
  3. 13 1
      textcircle.js

+ 0 - 1
.meteor/packages

@@ -4,7 +4,6 @@
 # 'meteor add' and 'meteor remove' will edit this file for you,
 # but you can also edit it by hand.
 
-autopublish
 mizzao:sharejs-codemirror
 twbs:bootstrap
 standard-minifiers

+ 0 - 1
.meteor/versions

@@ -1,7 +1,6 @@
 accounts-base@1.2.2
 accounts-password@1.1.4
 anti:i18n@0.4.3
-autopublish@1.0.4
 autoupdate@1.2.4
 babel-compiler@5.8.24_1
 babel-runtime@0.1.4

+ 13 - 1
textcircle.js

@@ -5,6 +5,9 @@ this.Documents = new Mongo.Collection("documents");
 EditingUsers = new Mongo.Collection("editingUsers");
 
 if (Meteor.isClient) {
+  Meteor.subscribe("documents");
+  Meteor.subscribe("editingUsers");
+
   Template.editor.helpers({
     // Return the id of the first document you can find.
     docid: function () {
@@ -113,6 +116,15 @@ if (Meteor.isClient) {
 } // end isClient...
 
 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 () {
     // Insert a document if there isn't one already.
     if (!Documents.findOne()) {
@@ -145,7 +157,7 @@ Meteor.methods({
     if (!this.userId) {
       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);
   },