]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-user-subscription/subscribe-button.component.ts
Registration css fixes
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-user-subscription / subscribe-button.component.ts
index 2261e07dd5f47cda9458c35620ba5726eea074c6..7a55a6ffbed3b8189da41f203fdf0ee8d807cd90 100644 (file)
@@ -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)
+      })
     }
   }
 }