]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/notification/peertube-socket.service.ts
Fix lint
[github/Chocobozzz/PeerTube.git] / client / src / app / core / notification / peertube-socket.service.ts
index 2f17fd70910f946586b19a4c7d3083dcb88ac34c..bc3f7b89374093c986f4c93314158f3b37466c0f 100644 (file)
@@ -53,13 +53,17 @@ export class PeerTubeSocket {
 
     await this.importIOIfNeeded()
 
+    // Prevent protractor issues https://github.com/angular/angular/issues/11853
     this.ngZone.runOutsideAngular(() => {
       this.notificationSocket = this.io(environment.apiUrl + '/user-notifications', {
         query: { accessToken: this.auth.getAccessToken() }
       })
 
-      this.notificationSocket.on('new-notification', (n: UserNotificationServer) => this.dispatchNotificationEvent('new', n))
+      this.notificationSocket.on('new-notification', (n: UserNotificationServer) => {
+        this.ngZone.run(() => this.dispatchNotificationEvent('new', n))
+      })
     })
+
   }
 
   private async initLiveVideosSocket () {
@@ -67,12 +71,18 @@ export class PeerTubeSocket {
 
     await this.importIOIfNeeded()
 
+    // Prevent protractor issues https://github.com/angular/angular/issues/11853
     this.ngZone.runOutsideAngular(() => {
       this.liveVideosSocket = this.io(environment.apiUrl + '/live-videos')
-
-      const type: LiveVideoEventType = 'state-change'
-      this.liveVideosSocket.on(type, (payload: LiveVideoEventPayload) => this.dispatchLiveVideoEvent(type, payload))
     })
+
+    const types: LiveVideoEventType[] = [ 'views-change', 'state-change' ]
+
+    for (const type of types) {
+      this.liveVideosSocket.on(type, (payload: LiveVideoEventPayload) => {
+        this.ngZone.run(() => this.dispatchLiveVideoEvent(type, payload))
+      })
+    }
   }
 
   private async importIOIfNeeded () {