X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fapp%2Fshared%2Fuser-subscription%2Fsubscribe-button.component.ts;h=0407856cbd1d89827e404e99974a6fddcc23062d;hb=f332ffa2a2e9bd7d223c78b6123dbba272f21e84;hp=8f1754c7f31ececd86134531f0d391e31b1edf96;hpb=88108880bbdba473cfe36ecbebc1c3c4f972e102;p=github%2FChocobozzz%2FPeerTube.git 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 8f1754c7f..0407856cb 100644 --- a/client/src/app/shared/user-subscription/subscribe-button.component.ts +++ b/client/src/app/shared/user-subscription/subscribe-button.component.ts @@ -28,19 +28,27 @@ export class SubscribeButtonComponent implements OnInit { private videoService: VideoService ) { } - get uri () { + get channelHandle () { return this.videoChannel.name + '@' + this.videoChannel.host } - get uriAccount () { - return this.videoChannel.ownerAccount.name + '@' + this.videoChannel.host + get channelUri () { + return this.videoChannel.url + } + + get rssUri () { + const rssFeed = this.videoService + .getVideoChannelFeedUrls(this.videoChannel.id) + .find(i => i.format === FeedFormat.RSS) + + return rssFeed.url } ngOnInit () { if (this.isUserLoggedIn()) { - this.userSubscriptionService.isSubscriptionExists(this.uri) + this.userSubscriptionService.doesSubscriptionExist(this.channelHandle) .subscribe( - res => this.subscribed = res[this.uri], + res => this.subscribed = res[this.channelHandle], err => this.notifier.error(err.message) ) @@ -56,13 +64,15 @@ export class SubscribeButtonComponent implements OnInit { } localSubscribe () { - this.userSubscriptionService.addSubscription(this.uri) + this.userSubscriptionService.addSubscription(this.channelHandle) .subscribe( () => { this.subscribed = true this.notifier.success( - this.i18n('Subscribed to {{nameWithHost}}', { nameWithHost: this.videoChannel.displayName }), + this.i18n('Subscribed to {{nameWithHost}}. You will be notified of all their new videos.', + { nameWithHost: this.videoChannel.displayName } + ), this.i18n('Subscribed') ) }, @@ -78,7 +88,7 @@ export class SubscribeButtonComponent implements OnInit { } localUnsubscribe () { - this.userSubscriptionService.deleteSubscription(this.uri) + this.userSubscriptionService.deleteSubscription(this.channelHandle) .subscribe( () => { this.subscribed = false @@ -100,12 +110,4 @@ export class SubscribeButtonComponent implements OnInit { gotoLogin () { this.router.navigate([ '/login' ]) } - - rssOpen () { - const rssFeed = this.videoService - .getVideoChannelFeedUrls(this.videoChannel.id) - .find(i => i.format === FeedFormat.RSS) - - window.open(rssFeed.url) - } }