Permalink
Browse files

Step 15.8: Update the users list reactively

  • Loading branch information...
1 parent dabcc7c commit b6eb92dc83dfa6f926fd223aa0401b1d6b378fdc @dotansimha dotansimha committed with DAB0mB Sep 27, 2016
Showing with 13 additions and 5 deletions.
  1. +13 −5 client/imports/app/parties/party-details.component.ts
@@ -43,6 +43,7 @@ export class PartyDetailsComponent implements OnInit, OnDestroy {
this.partySub = MeteorObservable.subscribe('party', this.partyId).subscribe(() => {
MeteorObservable.autorun().subscribe(() => {
this.party = Parties.findOne(this.partyId);
+ this.getUsers(this.party);
});
});
@@ -51,15 +52,22 @@ export class PartyDetailsComponent implements OnInit, OnDestroy {
}
this.uninvitedSub = MeteorObservable.subscribe('uninvited', this.partyId).subscribe(() => {
- this.users = Users.find({
- _id: {
- $ne: Meteor.userId()
- }
- }).zone();
+ this.getUsers(this.party);
});
});
}
+ getUsers(party: Party) {
+ if (party) {
+ this.users = Users.find({
+ _id: {
+ $nin: party.invited || [],
+ $ne: Meteor.userId()
+ }
+ }).zone();
+ }
+ }
+
saveParty() {
if (!Meteor.userId()) {
alert('Please log in to change this party');

0 comments on commit b6eb92d

Please sign in to comment.