parties: can create private parties

This commit is contained in:
Avital Oliver
2012-10-13 23:02:07 -07:00
parent f112ffac6b
commit ae6838dce4
4 changed files with 8 additions and 3 deletions

View File

@@ -209,6 +209,7 @@ Template.createDialog.events = {
'click .save': function (event, template) {
var title = template.find(".title").value;
var description = template.find(".description").value;
var public = !template.find(".private").checked;
if (title.length && description.length) {
var coords = Session.get("createCoords");
@@ -217,7 +218,10 @@ Template.createDialog.events = {
description: description,
x: coords.x,
y: coords.y,
public: true // XXX
public: public
}, function(error, party) {
if (!error)
Session.set("selected", party);
});
Session.set("showCreateDialog", false);
} else {

View File

@@ -57,7 +57,7 @@ Meteor.methods({
if (! this.userId)
throw new Meteor.Error(403, "You must be logged in");
Parties.insert({
return Parties.insert({
owner: this.userId,
x: options.x,
y: options.y,

View File

@@ -35,6 +35,7 @@
Title: <input type="text" class="title"><br>
Description<br><textarea class="description"></textarea><br>
<input type="checkbox" class="private">Private party?</input><br>
<input type="button" value="Add" class="save">
<input type="button" value="Cancel" class="cancel">

View File

@@ -7,5 +7,5 @@ Meteor.publish("directory", function () {
Meteor.publish("parties", function () {
return Parties.find(
{$or: [{"public": true}, {canSee: this.userId}]});
{$or: [{"public": true}, {canSee: this.userId}, {owner: this.userId}]});
});