From 5d86387ede0589982ce3736d13137afc352662cb Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Fri, 1 Mar 2019 00:59:12 -0500 Subject: [PATCH] added reply label --- .../stream/status/status.component.html | 32 +++++++++---------- .../stream/status/status.component.scss | 3 ++ .../stream/status/status.component.ts | 15 +++++---- .../services/models/mastodon.interfaces.ts | 3 +- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/app/components/stream/status/status.component.html b/src/app/components/stream/status/status.component.html index 8fda9d46..7802c346 100644 --- a/src/app/components/stream/status/status.component.html +++ b/src/app/components/stream/status/status.component.html @@ -20,36 +20,34 @@
-
+
bot
-
+
x-post
-
- thread -
+
+ thread +
+
+ replies +
- + sensitive content {{ contentWarningText }} - - + - diff --git a/src/app/components/stream/status/status.component.scss b/src/app/components/stream/status/status.component.scss index 7ac99ef6..e97270bf 100644 --- a/src/app/components/stream/status/status.component.scss +++ b/src/app/components/stream/status/status.component.scss @@ -76,6 +76,9 @@ background-color: rgb(0, 136, 61); background-color: rgb(0, 114, 51); } + &--discuss { + background-color: rgb(90, 0, 143); + } } &__name { display: inline-block; diff --git a/src/app/components/stream/status/status.component.ts b/src/app/components/stream/status/status.component.ts index aaca3763..0f42bf0d 100644 --- a/src/app/components/stream/status/status.component.ts +++ b/src/app/components/stream/status/status.component.ts @@ -17,6 +17,7 @@ export class StatusComponent implements OnInit { isCrossPoster: boolean; isThread: boolean; isContentWarned: boolean; + hasReply: boolean; contentWarningText: string; @Output() browseAccountEvent = new EventEmitter(); @@ -29,10 +30,7 @@ export class StatusComponent implements OnInit { @Input('statusWrapper') set statusWrapper(value: StatusWrapper) { this._statusWrapper = value; - this.status = value.status; - - this.checkLabels(this.status); - this.checkContentWarning(this.status); + this.status = value.status; if (this.status.reblog) { this.reblog = true; @@ -40,6 +38,9 @@ export class StatusComponent implements OnInit { } else { this.displayedStatus = this.status; } + + this.checkLabels(this.displayedStatus); + this.checkContentWarning(this.displayedStatus); if (!this.displayedStatus.account.display_name) { this.displayedStatus.account.display_name = this.displayedStatus.account.username; @@ -71,7 +72,7 @@ export class StatusComponent implements OnInit { return false; } - changeCw(cwIsActive: boolean){ + changeCw(cwIsActive: boolean) { this.isContentWarned = cwIsActive; } @@ -87,9 +88,11 @@ export class StatusComponent implements OnInit { } } - if (this.status.in_reply_to_account_id && this.status.in_reply_to_account_id === this.status.account.id) { + if (status.in_reply_to_account_id && status.in_reply_to_account_id === status.account.id) { this.isThread = true; } + + this.hasReply = status.replies_count > 0; } openAccount(account: Account): boolean { diff --git a/src/app/services/models/mastodon.interfaces.ts b/src/app/services/models/mastodon.interfaces.ts index 07db5653..e37d6ac7 100644 --- a/src/app/services/models/mastodon.interfaces.ts +++ b/src/app/services/models/mastodon.interfaces.ts @@ -131,7 +131,8 @@ export interface Status { reblog: Status; content: string; created_at: string; - reblogs_count: string; + reblogs_count: number; + replies_count: number; favourites_count: string; reblogged: boolean; favourited: boolean;