Last active
March 28, 2016 09:01
-
-
Save dai-shi/98b893f5f4bc63f6011f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/api/tasks.js b/imports/api/tasks.js | |
index f1d2c92..441feee 100644 | |
--- a/imports/api/tasks.js | |
+++ b/imports/api/tasks.js | |
@@ -6,8 +6,14 @@ export const Tasks = new Mongo.Collection('tasks'); | |
if (Meteor.isServer) { | |
// This code only runs on the server | |
+ // Only publish tasks that are public or belong to the current user | |
Meteor.publish('tasks', function tasksPublication() { | |
- return Tasks.find(); | |
+ return Tasks.find({ | |
+ $or: [ | |
+ { private: { $ne: true } }, | |
+ { owner: this.userId }, | |
+ ], | |
+ }); | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment