X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-user-subscription%2Fsubscribe-button.component.ts;h=a002bf4e7d749919297e20df7e1c02f1ab6b365c;hb=HEAD;hp=796493bd976c6796212e534681c08b747746a50e;hpb=1378c0d343028f3d40d7d795422684ab9e6a1599;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 796493bd9..a002bf4e7 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 @@ -1,7 +1,6 @@ import { concat, forkJoin, merge } from 'rxjs' import { Component, Input, OnChanges, OnInit } from '@angular/core' -import { Router } from '@angular/router' -import { AuthService, Notifier } from '@app/core' +import { AuthService, Notifier, RedirectService } from '@app/core' import { Account, VideoChannel, VideoService } from '@app/shared/shared-main' import { FeedFormat } from '@shared/models' import { UserSubscriptionService } from './user-subscription.service' @@ -27,7 +26,7 @@ export class SubscribeButtonComponent implements OnInit, OnChanges { constructor ( private authService: AuthService, - private router: Router, + private redirectService: RedirectService, private notifier: Notifier, private userSubscriptionService: UserSubscriptionService, private videoService: VideoService @@ -137,7 +136,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` ) @@ -152,12 +151,12 @@ export class SubscribeButtonComponent implements OnInit, OnChanges { } gotoLogin () { - this.router.navigate([ '/login' ]) + this.redirectService.redirectToLogin() } 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 +167,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 }