From 15feebd97ab5291f81b2a8cdcb16a8e4f4c5aa69 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 1 Dec 2020 15:02:31 +0100 Subject: Fix socket io messages angular changes --- client/src/app/core/notification/peertube-socket.service.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'client/src/app/core/notification/peertube-socket.service.ts') diff --git a/client/src/app/core/notification/peertube-socket.service.ts b/client/src/app/core/notification/peertube-socket.service.ts index 2f17fd709..7e1c43364 100644 --- a/client/src/app/core/notification/peertube-socket.service.ts +++ b/client/src/app/core/notification/peertube-socket.service.ts @@ -53,13 +53,14 @@ 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.dispatchNotificationEvent('new', n)) } private async initLiveVideosSocket () { @@ -67,12 +68,13 @@ 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 type: LiveVideoEventType = 'state-change' + this.liveVideosSocket.on(type, (payload: LiveVideoEventPayload) => this.dispatchLiveVideoEvent(type, payload)) } private async importIOIfNeeded () { -- cgit v1.2.3