Browse Source

Step 11.9: Only publish tasks the current user can see.

Frederic G. MARAND 8 years ago
parent
commit
d7c1c3e6a9
1 changed files with 6 additions and 1 deletions
  1. 6 1
      simple-todos-react.jsx

+ 6 - 1
simple-todos-react.jsx

@@ -17,7 +17,12 @@ if (Meteor.isClient) {
 
 if (Meteor.isServer) {
   Meteor.publish("tasks", function () {
-    return Tasks.find();
+    return Tasks.find({
+     $or: [
+       { private: { $ne: true }},
+       { owner: this.userId }
+     ]
+    });
   });
 }