diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-10 11:14:57 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-10 13:34:18 +0100 |
commit | db84cf89bcb20b5aaa87f4a6d92d41cc0060a089 (patch) | |
tree | eb98c1293c4bb12b40c435d9d457deb88e77bab7 /client/src/app/shared/user-subscription | |
parent | 6fd8c4da261ce12aeaa2a4d75e8eec1a43592784 (diff) | |
download | PeerTube-db84cf89bcb20b5aaa87f4a6d92d41cc0060a089.tar.gz PeerTube-db84cf89bcb20b5aaa87f4a6d92d41cc0060a089.tar.zst PeerTube-db84cf89bcb20b5aaa87f4a6d92d41cc0060a089.zip |
Fix client build
Diffstat (limited to 'client/src/app/shared/user-subscription')
-rw-r--r-- | client/src/app/shared/user-subscription/subscribe-button.component.html | 8 | ||||
-rw-r--r-- | client/src/app/shared/user-subscription/subscribe-button.component.ts | 21 |
2 files changed, 17 insertions, 12 deletions
diff --git a/client/src/app/shared/user-subscription/subscribe-button.component.html b/client/src/app/shared/user-subscription/subscribe-button.component.html index 1c2288ebb..7d33b0621 100644 --- a/client/src/app/shared/user-subscription/subscribe-button.component.html +++ b/client/src/app/shared/user-subscription/subscribe-button.component.html | |||
@@ -7,12 +7,12 @@ | |||
7 | <ng-template i18n #single>Subscribe</ng-template> | 7 | <ng-template i18n #single>Subscribe</ng-template> |
8 | <ng-template #multiple> | 8 | <ng-template #multiple> |
9 | <span i18n>Subscribe to all channels</span> | 9 | <span i18n>Subscribe to all channels</span> |
10 | <span *ngIf="isAtLeastOneChannelSubscribed()">{{subscribeStatus(true).length}}/{{subscribed.size}} | 10 | <span *ngIf="isAtLeastOneChannelSubscribed()">{{ subscribeStatus(true).length }}/{{ subscribed.size }} |
11 | <ng-container i18n>channels subscribed</ng-container> | 11 | <ng-container i18n>channels subscribed</ng-container> |
12 | </span> | 12 | </span> |
13 | </ng-template> | 13 | </ng-template> |
14 | </span> | 14 | </span> |
15 | <span *ngIf="!isBigButton() && displayFollowers && videoChannels.length > 1 && videoChannels[0].followersCount !== 0" class="followers-count"> | 15 | <span *ngIf="!isBigButton() && displayFollowers && videoChannels.length > 1 && videoChannel.followersCount !== 0" class="followers-count"> |
16 | {{ videoChannels[0].followersCount | myNumberFormatter }} | 16 | {{ videoChannels[0].followersCount | myNumberFormatter }} |
17 | </span> | 17 | </span> |
18 | </ng-template> | 18 | </ng-template> |
@@ -23,7 +23,7 @@ | |||
23 | (click)="subscribe()"> | 23 | (click)="subscribe()"> |
24 | <ng-template [ngTemplateOutlet]="userLoggedOut"></ng-template> | 24 | <ng-template [ngTemplateOutlet]="userLoggedOut"></ng-template> |
25 | </button> | 25 | </button> |
26 | 26 | ||
27 | <button | 27 | <button |
28 | *ngIf="isAllChannelsSubscribed()" type="button" | 28 | *ngIf="isAllChannelsSubscribed()" type="button" |
29 | class="btn btn-sm" role="button" | 29 | class="btn btn-sm" role="button" |
@@ -55,7 +55,7 @@ | |||
55 | </button> | 55 | </button> |
56 | 56 | ||
57 | <button class="dropdown-item" i18n>Subscribe with a Mastodon account:</button> | 57 | <button class="dropdown-item" i18n>Subscribe with a Mastodon account:</button> |
58 | <my-remote-subscribe showHelp="true" [uri]="channelUri"></my-remote-subscribe> | 58 | <my-remote-subscribe showHelp="true" [uri]="uri"></my-remote-subscribe> |
59 | 59 | ||
60 | <div class="dropdown-divider"></div> | 60 | <div class="dropdown-divider"></div> |
61 | 61 | ||
diff --git a/client/src/app/shared/user-subscription/subscribe-button.component.ts b/client/src/app/shared/user-subscription/subscribe-button.component.ts index 1ebfdc82f..888f6552a 100644 --- a/client/src/app/shared/user-subscription/subscribe-button.component.ts +++ b/client/src/app/shared/user-subscription/subscribe-button.component.ts | |||
@@ -40,11 +40,11 @@ export class SubscribeButtonComponent implements OnInit { | |||
40 | get handle () { | 40 | get handle () { |
41 | return this.account | 41 | return this.account |
42 | ? this.account.nameWithHost | 42 | ? this.account.nameWithHost |
43 | : this.videoChannels[0].name + '@' + this.videoChannels[0].host | 43 | : this.videoChannel.name + '@' + this.videoChannel.host |
44 | } | 44 | } |
45 | 45 | ||
46 | get channelHandle () { | 46 | get channelHandle () { |
47 | return this.getChannelHandler(this.videoChannels[0]) | 47 | return this.getChannelHandler(this.videoChannel) |
48 | } | 48 | } |
49 | 49 | ||
50 | get uri () { | 50 | get uri () { |
@@ -65,6 +65,10 @@ export class SubscribeButtonComponent implements OnInit { | |||
65 | return rssFeed.url | 65 | return rssFeed.url |
66 | } | 66 | } |
67 | 67 | ||
68 | get videoChannel () { | ||
69 | return this.videoChannels[0] | ||
70 | } | ||
71 | |||
68 | ngOnInit () { | 72 | ngOnInit () { |
69 | this.loadSubscribedStatus() | 73 | this.loadSubscribedStatus() |
70 | } | 74 | } |
@@ -83,7 +87,7 @@ export class SubscribeButtonComponent implements OnInit { | |||
83 | .filter(handle => this.subscribeStatus(false).includes(handle)) | 87 | .filter(handle => this.subscribeStatus(false).includes(handle)) |
84 | .map(handle => this.userSubscriptionService.addSubscription(handle)) | 88 | .map(handle => this.userSubscriptionService.addSubscription(handle)) |
85 | 89 | ||
86 | forkJoin(observableBatch) | 90 | merge(observableBatch, 2) |
87 | .subscribe( | 91 | .subscribe( |
88 | () => { | 92 | () => { |
89 | this.notifier.success( | 93 | this.notifier.success( |
@@ -153,18 +157,19 @@ export class SubscribeButtonComponent implements OnInit { | |||
153 | this.router.navigate([ '/login' ]) | 157 | this.router.navigate([ '/login' ]) |
154 | } | 158 | } |
155 | 159 | ||
156 | private getChannelHandler (videoChannel: VideoChannel) { | 160 | subscribeStatus (subscribed: boolean) { |
157 | return videoChannel.name + '@' + videoChannel.host | ||
158 | } | ||
159 | |||
160 | private subscribeStatus (subscribed: boolean) { | ||
161 | const accumulator: string[] = [] | 161 | const accumulator: string[] = [] |
162 | for (const [key, value] of this.subscribed.entries()) { | 162 | for (const [key, value] of this.subscribed.entries()) { |
163 | if (value === subscribed) accumulator.push(key) | 163 | if (value === subscribed) accumulator.push(key) |
164 | } | 164 | } |
165 | |||
165 | return accumulator | 166 | return accumulator |
166 | } | 167 | } |
167 | 168 | ||
169 | private getChannelHandler (videoChannel: VideoChannel) { | ||
170 | return videoChannel.name + '@' + videoChannel.host | ||
171 | } | ||
172 | |||
168 | private loadSubscribedStatus () { | 173 | private loadSubscribedStatus () { |
169 | if (!this.isUserLoggedIn()) return | 174 | if (!this.isUserLoggedIn()) return |
170 | 175 | ||