X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-user-subscription%2Fsubscribe-button.component.ts;h=7a55a6ffbed3b8189da41f203fdf0ee8d807cd90;hb=4c8a099198cd3af049847df91140735354b85a92;hp=2261e07dd5f47cda9458c35620ba5726eea074c6;hpb=77d873c56d112b7b1de4e703b08f7d8547dfb9fd;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts index 2261e07dd..7a55a6ffb 100644 --- a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts +++ b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts @@ -102,8 +102,8 @@ export class SubscribeButtonComponent implements OnInit, OnChanges { .map(handle => this.userSubscriptionService.addSubscription(handle)) forkJoin(observableBatch) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success( this.account ? $localize`Subscribed to all current channels of ${this.account.displayName}. You will be notified of all their new videos.` @@ -113,8 +113,8 @@ export class SubscribeButtonComponent implements OnInit, OnChanges { ) }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } unsubscribe () { @@ -137,7 +137,7 @@ export class SubscribeButtonComponent implements OnInit, OnChanges { this.notifier.success( this.account ? $localize`Unsubscribed from all channels of ${this.account.nameWithHost}` - : $localize`Unsubscribed from ${this.videoChannels[ 0 ].nameWithHost}`, + : $localize`Unsubscribed from ${this.videoChannels[0].nameWithHost}`, $localize`Unsubscribed` ) @@ -157,7 +157,7 @@ export class SubscribeButtonComponent implements OnInit, OnChanges { subscribeStatus (subscribed: boolean) { const accumulator: string[] = [] - for (const [key, value] of this.subscribed.entries()) { + for (const [ key, value ] of this.subscribed.entries()) { if (value === subscribed) accumulator.push(key) } @@ -168,6 +168,10 @@ export class SubscribeButtonComponent implements OnInit, OnChanges { return Array.from(this.subscribed.values()).every(v => v === true) } + isRemoteSubscribeAvailable () { + return !this.isUserLoggedIn() + } + private getChannelHandler (videoChannel: VideoChannel) { return videoChannel.name + '@' + videoChannel.host } @@ -182,11 +186,11 @@ export class SubscribeButtonComponent implements OnInit, OnChanges { merge( this.userSubscriptionService.listenToSubscriptionCacheChange(handle), this.userSubscriptionService.doesSubscriptionExist(handle) - ).subscribe( - res => this.subscribed.set(handle, res), + ).subscribe({ + next: res => this.subscribed.set(handle, res), - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } } }