diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-01-08 22:13:47 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-01-10 10:12:09 +0100 |
commit | 9270ccf6dca5b2955ad126947d4296deb385fdcb (patch) | |
tree | 120807348c51437aaa35e52bed9122cdfc08437f /client/src/app/+accounts | |
parent | b061c8edb053d4a7a02f09d93d406f6a8c58006e (diff) | |
download | PeerTube-9270ccf6dca5b2955ad126947d4296deb385fdcb.tar.gz PeerTube-9270ccf6dca5b2955ad126947d4296deb385fdcb.tar.zst PeerTube-9270ccf6dca5b2955ad126947d4296deb385fdcb.zip |
Make subscribe buttons observe subscription statuses to synchronise
Diffstat (limited to 'client/src/app/+accounts')
3 files changed, 8 insertions, 17 deletions
diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.html b/client/src/app/+accounts/account-video-channels/account-video-channels.component.html index 93f43a350..781156840 100644 --- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.html +++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.html | |||
@@ -9,11 +9,7 @@ | |||
9 | <img [src]="videoChannel.avatarUrl" alt="Avatar" /> | 9 | <img [src]="videoChannel.avatarUrl" alt="Avatar" /> |
10 | 10 | ||
11 | <div>{{ videoChannel.displayName }}</div> | 11 | <div>{{ videoChannel.displayName }}</div> |
12 | <div class="followers">{{ videoChannel.followersCount }} | 12 | <div class="followers" i18n>{videoChannel.followersCount, plural, =1 {1 subscriber} other {{{ videoChannel.followersCount }} subscribers}}</div> |
13 | <ng-container *ngIf="videoChannel.followersCount === 1; then single; else multiple"></ng-container> | ||
14 | <ng-template i18n #single>subscriber</ng-template> | ||
15 | <ng-template i18n #multiple>subscribers</ng-template> | ||
16 | </div> | ||
17 | </a> | 13 | </a> |
18 | 14 | ||
19 | <my-subscribe-button [videoChannels]="[videoChannel]"></my-subscribe-button> | 15 | <my-subscribe-button [videoChannels]="[videoChannel]"></my-subscribe-button> |
diff --git a/client/src/app/+accounts/accounts.component.html b/client/src/app/+accounts/accounts.component.html index 1b6eb480e..be40b63ca 100644 --- a/client/src/app/+accounts/accounts.component.html +++ b/client/src/app/+accounts/accounts.component.html | |||
@@ -28,12 +28,7 @@ | |||
28 | > | 28 | > |
29 | </my-user-moderation-dropdown> | 29 | </my-user-moderation-dropdown> |
30 | </div> | 30 | </div> |
31 | <div class="actor-followers"> | 31 | <div class="actor-followers" i18n>{account.followersCount, plural, =1 {1 subscriber} other {{{ account.followersCount }} subscribers}}</div> |
32 | {{ account.followersCount }} | ||
33 | <ng-container *ngIf="account.followersCount === 1; then single; else multiple"></ng-container> | ||
34 | <ng-template i18n #single>subscriber</ng-template> | ||
35 | <ng-template i18n #multiple>subscribers</ng-template> | ||
36 | </div> | ||
37 | </div> | 32 | </div> |
38 | 33 | ||
39 | <my-subscribe-button *ngIf="videoChannels" [account]="account" [videoChannels]="videoChannels"></my-subscribe-button> | 34 | <my-subscribe-button *ngIf="videoChannels" [account]="account" [videoChannels]="videoChannels"></my-subscribe-button> |
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts index e3a503f4c..8bde7ad07 100644 --- a/client/src/app/+accounts/accounts.component.ts +++ b/client/src/app/+accounts/accounts.component.ts | |||
@@ -40,15 +40,15 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
40 | map(params => params[ 'accountId' ]), | 40 | map(params => params[ 'accountId' ]), |
41 | distinctUntilChanged(), | 41 | distinctUntilChanged(), |
42 | switchMap(accountId => this.accountService.getAccount(accountId)), | 42 | switchMap(accountId => this.accountService.getAccount(accountId)), |
43 | tap(account => this.getUserIfNeeded(account)), | 43 | tap(account => { |
44 | this.account = account | ||
45 | this.getUserIfNeeded(account) | ||
46 | }), | ||
47 | switchMap(account => this.videoChannelService.listAccountVideoChannels(account)), | ||
44 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])) | 48 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])) |
45 | ) | 49 | ) |
46 | .subscribe( | 50 | .subscribe( |
47 | account => { | 51 | videoChannels => this.videoChannels = videoChannels.data, |
48 | this.account = account | ||
49 | this.videoChannelService.listAccountVideoChannels(account) | ||
50 | .subscribe(videoChannels => this.videoChannels = videoChannels.data) | ||
51 | }, | ||
52 | 52 | ||
53 | err => this.notifier.error(err.message) | 53 | err => this.notifier.error(err.message) |
54 | ) | 54 | ) |