aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/notification
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-21 11:24:07 +0100
committerChocobozzz <me@florianbigard.com>2019-02-21 14:04:44 +0100
commit84c7cde6e81426a42e7aa29187b473bc89f1c8f6 (patch)
tree5c85056f29bc563a6ea29ced4736d4d5cd9851fd /client/src/app/core/notification
parent1e17071bacc8a78c9145ba602113b1b52dd8fe7b (diff)
downloadPeerTube-84c7cde6e81426a42e7aa29187b473bc89f1c8f6.tar.gz
PeerTube-84c7cde6e81426a42e7aa29187b473bc89f1c8f6.tar.zst
PeerTube-84c7cde6e81426a42e7aa29187b473bc89f1c8f6.zip
Update E2E tests
Diffstat (limited to 'client/src/app/core/notification')
-rw-r--r--client/src/app/core/notification/user-notification-socket.service.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/client/src/app/core/notification/user-notification-socket.service.ts b/client/src/app/core/notification/user-notification-socket.service.ts
index 493f03e35..3f22da476 100644
--- a/client/src/app/core/notification/user-notification-socket.service.ts
+++ b/client/src/app/core/notification/user-notification-socket.service.ts
@@ -1,4 +1,4 @@
1import { Injectable } from '@angular/core' 1import { Injectable, NgZone } from '@angular/core'
2import { environment } from '../../../environments/environment' 2import { environment } from '../../../environments/environment'
3import { UserNotification as UserNotificationServer } from '../../../../../shared' 3import { UserNotification as UserNotificationServer } from '../../../../../shared'
4import { Subject } from 'rxjs' 4import { Subject } from 'rxjs'
@@ -13,7 +13,8 @@ export class UserNotificationSocket {
13 private socket: SocketIOClient.Socket 13 private socket: SocketIOClient.Socket
14 14
15 constructor ( 15 constructor (
16 private auth: AuthService 16 private auth: AuthService,
17 private ngZone: NgZone
17 ) {} 18 ) {}
18 19
19 dispatch (type: NotificationEvent, notification?: UserNotificationServer) { 20 dispatch (type: NotificationEvent, notification?: UserNotificationServer) {
@@ -32,10 +33,12 @@ export class UserNotificationSocket {
32 // FIXME: import('..') returns a struct module, containing a "default" field corresponding to our sanitizeHtml function 33 // FIXME: import('..') returns a struct module, containing a "default" field corresponding to our sanitizeHtml function
33 const io: typeof import ('socket.io-client') = (await import('socket.io-client') as any).default 34 const io: typeof import ('socket.io-client') = (await import('socket.io-client') as any).default
34 35
35 this.socket = io(environment.apiUrl + '/user-notifications', { 36 this.ngZone.runOutsideAngular(() => {
36 query: { accessToken: this.auth.getAccessToken() } 37 this.socket = io(environment.apiUrl + '/user-notifications', {
37 }) 38 query: { accessToken: this.auth.getAccessToken() }
39 })
38 40
39 this.socket.on('new-notification', (n: UserNotificationServer) => this.dispatch('new', n)) 41 this.socket.on('new-notification', (n: UserNotificationServer) => this.dispatch('new', n))
42 })
40 } 43 }
41} 44}