diff options
Diffstat (limited to 'client/src/app/+accounts/accounts.component.ts')
-rw-r--r-- | client/src/app/+accounts/accounts.component.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts index 8bde7ad07..da4a0b28e 100644 --- a/client/src/app/+accounts/accounts.component.ts +++ b/client/src/app/+accounts/accounts.component.ts | |||
@@ -18,7 +18,7 @@ import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | |||
18 | export class AccountsComponent implements OnInit, OnDestroy { | 18 | export class AccountsComponent implements OnInit, OnDestroy { |
19 | account: Account | 19 | account: Account |
20 | user: User | 20 | user: User |
21 | videoChannels: VideoChannel[] | 21 | videoChannels: VideoChannel[] = [] |
22 | 22 | ||
23 | private routeSub: Subscription | 23 | private routeSub: Subscription |
24 | 24 | ||
@@ -58,6 +58,13 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
58 | if (this.routeSub) this.routeSub.unsubscribe() | 58 | if (this.routeSub) this.routeSub.unsubscribe() |
59 | } | 59 | } |
60 | 60 | ||
61 | get naiveAggregatedSubscribers () { | ||
62 | return this.videoChannels.reduce( | ||
63 | (acc, val) => acc + val.followersCount, | ||
64 | this.account.followersCount // accumulator starts with the base number of subscribers the account has | ||
65 | ) | ||
66 | } | ||
67 | |||
61 | onUserChanged () { | 68 | onUserChanged () { |
62 | this.getUserIfNeeded(this.account) | 69 | this.getUserIfNeeded(this.account) |
63 | } | 70 | } |
@@ -70,6 +77,10 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
70 | this.notifier.success(this.i18n('Username copied')) | 77 | this.notifier.success(this.i18n('Username copied')) |
71 | } | 78 | } |
72 | 79 | ||
80 | subscribersDisplayFor (count: number) { | ||
81 | return this.i18n(`{count, plural, =1 {1 subscriber} other {${count} subscribers}}`, { count }) | ||
82 | } | ||
83 | |||
73 | private getUserIfNeeded (account: Account) { | 84 | private getUserIfNeeded (account: Account) { |
74 | if (!account.userId) return | 85 | if (!account.userId) return |
75 | if (!this.authService.isLoggedIn()) return | 86 | if (!this.authService.isLoggedIn()) return |