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/e2e/src/po/player.po.ts | 2 +- client/src/app/core/notification/peertube-socket.service.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'client') diff --git a/client/e2e/src/po/player.po.ts b/client/e2e/src/po/player.po.ts index 1bba11171..48e61dfea 100644 --- a/client/e2e/src/po/player.po.ts +++ b/client/e2e/src/po/player.po.ts @@ -17,7 +17,7 @@ export class PlayerPage { } waitUntilPlayerWrapper () { - const elem = element(by.css('#video-wrapper')) + const elem = element(by.css('#placeholder-preview')) return browser.wait(browser.ExpectedConditions.presenceOf(elem)) } 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