diff options
author | Chocobozzz <me@florianbigard.com> | 2020-12-10 10:20:04 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-12-10 10:20:04 +0100 |
commit | dc1f314efdae14f838c109ebbc1e8d69273d0319 (patch) | |
tree | ea1eff931e3416a8db25b2bf1187cb44020b4553 /client/src/app | |
parent | e43b5a3fa887e82e32ac43a9736cf2c784fb7717 (diff) | |
download | PeerTube-dc1f314efdae14f838c109ebbc1e8d69273d0319.tar.gz PeerTube-dc1f314efdae14f838c109ebbc1e8d69273d0319.tar.zst PeerTube-dc1f314efdae14f838c109ebbc1e8d69273d0319.zip |
Fix socket io with angular
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.html | 8 | ||||
-rw-r--r-- | client/src/app/core/notification/peertube-socket.service.ts | 9 |
2 files changed, 9 insertions, 8 deletions
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.html b/client/src/app/+videos/+video-watch/video-watch.component.html index 9cabe3bbc..669fede43 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.html +++ b/client/src/app/+videos/+video-watch/video-watch.component.html | |||
@@ -66,12 +66,8 @@ | |||
66 | <div class="video-info-first-row-bottom"> | 66 | <div class="video-info-first-row-bottom"> |
67 | <div class="d-none d-md-block video-info-date-views"> | 67 | <div class="d-none d-md-block video-info-date-views"> |
68 | <ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container> | 68 | <ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container> |
69 | 69 | • | |
70 | <span i18n [title]="video.getExactNumberOfViews()" class="views"> | 70 | <my-video-views-counter [video]="video"></my-video-views-counter> |
71 | • {{ video.views | myNumberFormatter }} | ||
72 | <ng-container *ngIf="!video.isLive">views</ng-container> | ||
73 | <ng-container *ngIf="video.isLive">viewers</ng-container> | ||
74 | </span> | ||
75 | </div> | 71 | </div> |
76 | 72 | ||
77 | <div class="video-actions-rates"> | 73 | <div class="video-actions-rates"> |
diff --git a/client/src/app/core/notification/peertube-socket.service.ts b/client/src/app/core/notification/peertube-socket.service.ts index 089276cfc..bc3f7b893 100644 --- a/client/src/app/core/notification/peertube-socket.service.ts +++ b/client/src/app/core/notification/peertube-socket.service.ts | |||
@@ -58,9 +58,12 @@ export class PeerTubeSocket { | |||
58 | this.notificationSocket = this.io(environment.apiUrl + '/user-notifications', { | 58 | this.notificationSocket = this.io(environment.apiUrl + '/user-notifications', { |
59 | query: { accessToken: this.auth.getAccessToken() } | 59 | query: { accessToken: this.auth.getAccessToken() } |
60 | }) | 60 | }) |
61 | |||
62 | this.notificationSocket.on('new-notification', (n: UserNotificationServer) => { | ||
63 | this.ngZone.run(() => this.dispatchNotificationEvent('new', n)) | ||
64 | }) | ||
61 | }) | 65 | }) |
62 | 66 | ||
63 | this.notificationSocket.on('new-notification', (n: UserNotificationServer) => this.dispatchNotificationEvent('new', n)) | ||
64 | } | 67 | } |
65 | 68 | ||
66 | private async initLiveVideosSocket () { | 69 | private async initLiveVideosSocket () { |
@@ -76,7 +79,9 @@ export class PeerTubeSocket { | |||
76 | const types: LiveVideoEventType[] = [ 'views-change', 'state-change' ] | 79 | const types: LiveVideoEventType[] = [ 'views-change', 'state-change' ] |
77 | 80 | ||
78 | for (const type of types) { | 81 | for (const type of types) { |
79 | this.liveVideosSocket.on(type, (payload: LiveVideoEventPayload) => this.dispatchLiveVideoEvent(type, payload)) | 82 | this.liveVideosSocket.on(type, (payload: LiveVideoEventPayload) => { |
83 | this.ngZone.run(() => this.dispatchLiveVideoEvent(type, payload)) | ||
84 | }) | ||
80 | } | 85 | } |
81 | } | 86 | } |
82 | 87 | ||