Skip to content

Commit

Permalink
Step 16.5: Add isPublic and isInvited properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha committed Nov 27, 2016
1 parent 34d544f commit 0e145da
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion client/imports/app/parties/party-details.component.ts
Expand Up @@ -81,7 +81,8 @@ export class PartyDetailsComponent implements OnInit, OnDestroy {
$set: {
name: this.party.name,
description: this.party.description,
location: this.party.location
location: this.party.location,
'public': this.party.public
}
});
}
Expand All @@ -106,6 +107,20 @@ export class PartyDetailsComponent implements OnInit, OnDestroy {
return this.party && this.user && this.user._id === this.party.owner;
}

get isPublic(): boolean {
return this.party && this.party.public;
}

get isInvited(): boolean {
if (this.party && this.user) {
const invited = this.party.invited || [];

return invited.indexOf(this.user._id) !== -1;
}

return false;
}

ngOnDestroy() {
this.paramsSub.unsubscribe();
this.partySub.unsubscribe();
Expand Down

0 comments on commit 0e145da

Please sign in to comment.