 From daced371e38e6a378d2ee6d0566b7b640137dcf0 Mon Sep 17 00:00:00 2001
 From: ShMcK <me@shmck.com>
 Date: Sun, 23 Aug 2015 19:02:11 +0900
-Subject: [PATCH 20/82] Step 4.2: Initialize the parties-form view
+Subject: [PATCH 20/96] Step 4.2: Initialize the parties-form view
 
 ---
  client/parties-form/parties-form.ng.html | 7 +++++++

From ace317b5ecfe43bb2e94a83c9e876615c775de58 Mon Sep 17 00:00:00 2001
From: ShMcK <me@shmck.com>
Date: Thu, 27 Aug 2015 13:35:05 +0900
Subject: [PATCH 66/82] Step 8.1: Remove insecure, add accounts-password &
 accounts-ui

---

-- 
2.3.5


From 8b60a91d8335b60e793947f39e7d7d59b9d9fb0c Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:02:42 +0900
Subject: [PATCH 83/96] Step 9.1: remove autopublish package

---
 .meteor/packages | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.meteor/packages b/.meteor/packages
index 037f969..8360b5d 100644
--- a/.meteor/packages
+++ b/.meteor/packages
@@ -5,7 +5,6 @@
 # but you can also edit it by hand.
 
 meteor-platform
-autopublish
 
 mdg:tutorial-step-diff-compiler
 shmck:angular2
-- 
2.3.5


From 4036c457ae984da39c8266ac570ea9d146b96762 Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:03:54 +0900
Subject: [PATCH 84/96] Step 9.2: Publish parties collection

---
 server/parties.ts | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 server/parties.ts

diff --git a/server/parties.ts b/server/parties.ts
new file mode 100644
index 0000000..6c7413f
--- /dev/null
+++ b/server/parties.ts
@@ -0,0 +1,3 @@
+Meteor.publish('parties', function () {
+  return Parties.find();
+});
\ No newline at end of file
-- 
2.3.5


From 72b19400de7f3236550d15a52aa9b7a18ba7c612 Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:04:53 +0900
Subject: [PATCH 85/96] Step 9.3: subscribe to parties colleciton in
 PartiesList

---
 client/parties-list/parties-list.ts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/client/parties-list/parties-list.ts b/client/parties-list/parties-list.ts
index 8c93a3e..6faed45 100644
--- a/client/parties-list/parties-list.ts
+++ b/client/parties-list/parties-list.ts
@@ -15,6 +15,7 @@ export class PartiesList {
   parties: IParty[];
   partyService:PartyService;
   constructor (@Inject(PartyService) partyService:PartyService) {
+    Meteor.subscribe('parties');
     this.partyService = partyService;
     Tracker.autorun(zone.bind(() => {
       this.parties = Parties.find().fetch();
-- 
2.3.5


From 00f9bc3548846d0d85140a8d6a30dc95bc3f9fa2 Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:06:14 +0900
Subject: [PATCH 86/96] Step 9.4: publish only parties that are public or owned
 by the user

---
 server/parties.ts | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/server/parties.ts b/server/parties.ts
index 6c7413f..63ea457 100644
--- a/server/parties.ts
+++ b/server/parties.ts
@@ -1,3 +1,13 @@
 Meteor.publish('parties', function () {
-  return Parties.find();
+  return Parties.find({
+    $or:[
+      {$and:[
+        {"isPublic": true},
+        {"isPublic": {$exists: true}}
+      ]},
+      {$and:[
+        {owner: this.userId},
+        {owner: {$exists: true}}
+      ]}
+    ]});
 });
\ No newline at end of file
-- 
2.3.5


From e61ae7d20c159cd84a025b1cb2d722a8af446159 Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:07:25 +0900
Subject: [PATCH 87/96] Step 9.5: load initial parties with owner and isPublic
 values

---
 server/loadParties.ts | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/server/loadParties.ts b/server/loadParties.ts
index 9dd05e7..554afb8 100644
--- a/server/loadParties.ts
+++ b/server/loadParties.ts
@@ -1,14 +1,22 @@
 Meteor.startup(function () {
   if (Parties.find().count() === 0) {
 
-    var parties:IParty[] = [
-      {'name': 'Dubstep-Free Zone',
-        'description': 'Can we please just for an evening not listen to dubstep.'},
-      {'name': 'All dubstep all the time',
-        'description': 'Get it on!'},
-      {'name': 'Savage lounging',
-        'description': 'Leisure suit required. And only fiercest manners.'}
-    ];
+    var parties:IParty[] = [{
+      name: 'Dubstep-Free Zone',
+      description: 'Can we please just for an evening not listen to dubstep.',
+      owner: 'anonymous',
+      isPublic: true
+    }, {
+      name: 'All dubstep all the time',
+      description: 'Get it on!',
+      owner: 'anonymous',
+      isPublic: true
+    }, {
+      name: 'Savage lounging',
+      description: 'Leisure suit required. And only fiercest manners.',
+      owner: 'anonymous',
+      isPublic: false
+    }];
 
     for (var i = 0; i < parties.length; i++)
       Parties.insert(parties[i]);
-- 
2.3.5


From e50ef04530a15807f81032d7eb1a8cc60a13c382 Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:09:10 +0900
Subject: [PATCH 88/96] Step 9.6: Add isPublic value to IParty interface

---
 typings/socially/socially.d.ts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/typings/socially/socially.d.ts b/typings/socially/socially.d.ts
index cfadbb5..9337c78 100644
--- a/typings/socially/socially.d.ts
+++ b/typings/socially/socially.d.ts
@@ -7,4 +7,5 @@ interface IParty {
   name: string;
   description: string;
   owner: string;
+  isPublic: boolean;
 }
\ No newline at end of file
-- 
2.3.5


From fc0dcfec073873e58141f53ae1dffa220e509441 Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:09:53 +0900
Subject: [PATCH 89/96] Step 9.7: Subscribe to parties in PartyDetails

---
 client/party-details/party-details.ts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/client/party-details/party-details.ts b/client/party-details/party-details.ts
index d6f2511..d3801d9 100644
--- a/client/party-details/party-details.ts
+++ b/client/party-details/party-details.ts
@@ -43,6 +43,7 @@ export class PartyDetails {
     return Meteor.userId();
   }
   onActivate() {
+    Meteor.subscribe('parties', this.partyId);
     this.party = Parties.find(this.partyId).fetch()[0];
     if (this.party) {
       console.log('loading...');
-- 
2.3.5


From c316a1de99c21ae9397d558c03f8c01c6401ba32 Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:10:44 +0900
Subject: [PATCH 90/96] Step 9.8: add isPublic to PartiesForm form

---
 client/parties-form/parties-form.ts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/client/parties-form/parties-form.ts b/client/parties-form/parties-form.ts
index 1fa8f5a..aa065a1 100644
--- a/client/parties-form/parties-form.ts
+++ b/client/parties-form/parties-form.ts
@@ -16,7 +16,8 @@ export class PartiesForm {
     this.partyService = partyService;
     this.partiesForm = new ControlGroup({
       name: new Control('', Validators.required),
-      description: new Control('', Validators.required)
+      description: new Control('', Validators.required),
+      isPublic: new Control(false)
     });
   }
   add(party:IParty) {
-- 
2.3.5


From b9e796ace686ffa872aa93020a0eab2febf869e7 Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:11:24 +0900
Subject: [PATCH 91/96] Step 9.9: add isPublic to parties-form template

---
 client/parties-form/parties-form.ng.html | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/client/parties-form/parties-form.ng.html b/client/parties-form/parties-form.ng.html
index 15b84df..1f2781f 100644
--- a/client/parties-form/parties-form.ng.html
+++ b/client/parties-form/parties-form.ng.html
@@ -3,5 +3,7 @@
   <input type="text" ng-control="name">
   <label>Description</label>
   <input type="text" ng-control="description">
+  <label>Public</label>
+  <input type="checkbox" ng-control="isPublic">
   <button>Add</button>
 </form>
\ No newline at end of file
-- 
2.3.5


From 34cc6a1094d90aa475b7437d5abead454fb0551e Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:12:31 +0900
Subject: [PATCH 92/96] Step 9.11: add isPublic to party-details template form

---
 client/party-details/party-details.ng.html | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/client/party-details/party-details.ng.html b/client/party-details/party-details.ng.html
index ae6bfb6..1b4092a 100644
--- a/client/party-details/party-details.ng.html
+++ b/client/party-details/party-details.ng.html
@@ -5,6 +5,9 @@
   <label>Description</label>
   <input type="text" [(ng-model)]="party.description">
 
+  <label>Is public</label>
+  <input type="checkbox" [(ng-model)]="party.isPublic">
+
   <button type="submit">Save</button>
   <button (click)="reset($event)">Reset form</button>
   <button [router-link]="['/parties-list']">Cancel</button>
-- 
2.3.5


From 73b1ba9ec3d8f3c760a7aeaabf5d53ee0891b661 Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:13:32 +0900
Subject: [PATCH 93/96] Step 9.12: Publish email and profile fields of users

---
 server/users.ts | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 server/users.ts

diff --git a/server/users.ts b/server/users.ts
new file mode 100644
index 0000000..f5becea
--- /dev/null
+++ b/server/users.ts
@@ -0,0 +1,3 @@
+Meteor.publish("users", function () {
+  return Meteor.users.find({}, {fields: {emails: 1, profile: 1}});
+});
\ No newline at end of file
-- 
2.3.5


From 0938a56e89dd2b69a052bfb1027c050c1287d1cf Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:14:51 +0900
Subject: [PATCH 94/96] Step 9.13: subscribe to users in PartyDetails

---
 client/party-details/party-details.ts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/client/party-details/party-details.ts b/client/party-details/party-details.ts
index d3801d9..e31fa5e 100644
--- a/client/party-details/party-details.ts
+++ b/client/party-details/party-details.ts
@@ -43,6 +43,8 @@ export class PartyDetails {
     return Meteor.userId();
   }
   onActivate() {
+    Meteor.subscribe('users');
+    this.users = Meteor.users();
     Meteor.subscribe('parties', this.partyId);
     this.party = Parties.find(this.partyId).fetch()[0];
     if (this.party) {
-- 
2.3.5


From 9ad0a22fbf28e3b04080669439e06e6e5375590a Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:16:00 +0900
Subject: [PATCH 95/96] Step 9.14: load NgFor into PartyDetails

---
 client/party-details/party-details.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/client/party-details/party-details.ts b/client/party-details/party-details.ts
index e31fa5e..5dd6a0c 100644
--- a/client/party-details/party-details.ts
+++ b/client/party-details/party-details.ts
@@ -1,4 +1,4 @@
-import {Component, View, Inject} from 'angular2/angular2';
+import {Component, View, Inject, NgFor} from 'angular2/angular2';
 import {RouteParams, RouterLink} from 'angular2/router';
 import {FORM_DIRECTIVES} from 'angular2/angular2';
 import {PartyService} from 'client/lib/party-service';
@@ -9,7 +9,7 @@ import {PartyService} from 'client/lib/party-service';
 })
 @View({
   templateUrl: 'client/party-details/party-details.ng.html',
-  directives: [RouterLink, FORM_DIRECTIVES]
+  directives: [RouterLink, FORM_DIRECTIVES, NgFor]
 })
 export class PartyDetails {
   partyId: string;
-- 
2.3.5


From 70e916d9ee78729bdc5092928fae4921c0c5dbbf Mon Sep 17 00:00:00 2001
From: ShMcK <shawn.j.mckay@gmail.com>
Date: Thu, 10 Sep 2015 16:17:19 +0900
Subject: [PATCH 96/96] Step 9.15: load list of users in party-details
 template, wrap in a div

---
 client/party-details/party-details.ng.html | 31 +++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/client/party-details/party-details.ng.html b/client/party-details/party-details.ng.html
index 1b4092a..b5e816f 100644
--- a/client/party-details/party-details.ng.html
+++ b/client/party-details/party-details.ng.html
@@ -1,14 +1,23 @@
-<form (submit)="save($event)">
-  <label>Name</label>
-  <input type="text" [(ng-model)]="party.name">
+<div>
+  <form (submit)="save($event)">
+    <label>Name</label>
+    <input type="text" [(ng-model)]="party.name">
 
-  <label>Description</label>
-  <input type="text" [(ng-model)]="party.description">
+    <label>Description</label>
+    <input type="text" [(ng-model)]="party.description">
 
-  <label>Is public</label>
-  <input type="checkbox" [(ng-model)]="party.isPublic">
+    <label>Is public</label>
+    <input type="checkbox" [(ng-model)]="party.isPublic">
 
-  <button type="submit">Save</button>
-  <button (click)="reset($event)">Reset form</button>
-  <button [router-link]="['/parties-list']">Cancel</button>
-</form>
\ No newline at end of file
+    <button type="submit">Save</button>
+    <button (click)="reset($event)">Reset form</button>
+    <button [router-link]="['/parties-list']">Cancel</button>
+  </form>
+
+  <ul>
+    Users:
+    <li *ng-for="#user of users">
+      <div>{{ user.emails[0].address }}</div>
+    </li>
+  </ul>
+</div>
\ No newline at end of file
-- 
2.3.5

