From 0e145dafc33f855d910dbbc7292f18ee5f2acb49 Mon Sep 17 00:00:00 2001 From: dotansimha Date: Tue, 27 Sep 2016 11:44:34 +0300 Subject: [PATCH] Step 16.5: Add isPublic and isInvited properties --- .../app/parties/party-details.component.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/client/imports/app/parties/party-details.component.ts b/client/imports/app/parties/party-details.component.ts index 7562d03ab..d498a6ec4 100644 --- a/client/imports/app/parties/party-details.component.ts +++ b/client/imports/app/parties/party-details.component.ts @@ -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 } }); } @@ -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();