]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/user-subscription/subscribe-button.component.ts
Add ability to list all local videos on client
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / user-subscription / subscribe-button.component.ts
index e3c758942703c91bd5c316e570949d065edfc3de..315ea5037d8d13cb3ab1329a90eecea27d0aaf6c 100644 (file)
@@ -5,6 +5,8 @@ import { UserSubscriptionService } from '@app/shared/user-subscription/user-subs
 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
 import { NotificationsService } from 'angular2-notifications'
 import { I18n } from '@ngx-translate/i18n-polyfill'
+import { VideoService } from '@app/shared/video/video.service'
+import { FeedFormat } from '../../../../../shared/models/feeds'
 
 @Component({
   selector: 'my-subscribe-button',
@@ -23,7 +25,8 @@ export class SubscribeButtonComponent implements OnInit {
     private router: Router,
     private notificationsService: NotificationsService,
     private userSubscriptionService: UserSubscriptionService,
-    private i18n: I18n
+    private i18n: I18n,
+    private videoService: VideoService
   ) { }
 
   get uri () {
@@ -49,6 +52,7 @@ export class SubscribeButtonComponent implements OnInit {
     if (this.isUserLoggedIn()) {
       this.localSubscribe()
     } else {
+      this.authService.redirectUrl = this.router.url
       this.gotoLogin()
     }
   }
@@ -100,6 +104,10 @@ export class SubscribeButtonComponent implements OnInit {
   }
 
   rssOpen () {
-    window.open('')
+    const rssFeed = this.videoService
+                      .getVideoChannelFeedUrls(this.videoChannel.id)
+                      .find(i => i.format === FeedFormat.RSS)
+
+    window.open(rssFeed.url)
   }
 }