|
@@ -97,5 +97,15 @@ Meteor.methods({
|
|
|
|
|
|
setChecked: function (taskId, setChecked) {
|
|
|
Tasks.update(taskId, { $set : { checked: setChecked }});
|
|
|
+ },
|
|
|
+
|
|
|
+ setPrivate: function (taskId, setToPrivate) {
|
|
|
+ var task = Tasks.findOne(taskId);
|
|
|
+
|
|
|
+ // Make sure only the task owner can make the task private.
|
|
|
+ if (task.owner !== Meteor.userId()) {
|
|
|
+ throw new Meteor.Error('not-authorized');
|
|
|
+ }
|
|
|
+ Tasks.update(taskId, { $set: { private: setToPrivate }});
|
|
|
}
|
|
|
});
|