diff options
Diffstat (limited to 'client/src/app/shared/user-subscription/subscribe-button.component.ts')
-rw-r--r-- | client/src/app/shared/user-subscription/subscribe-button.component.ts | 21 |
1 files changed, 13 insertions, 8 deletions
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 | ||