diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-17 14:42:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-18 08:35:06 +0200 |
commit | 9df52d660feb722404be00a50f3c8a612bec1c15 (patch) | |
tree | dde52880fa012874d24c60f64eb596b0a789cc8b /client/src/app/+videos/+video-watch | |
parent | adb8809d43648ea0a64d6845bb39aa3bd0e005a6 (diff) | |
download | PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.gz PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.zst PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.zip |
Migrate client to eslint
Diffstat (limited to 'client/src/app/+videos/+video-watch')
12 files changed, 45 insertions, 40 deletions
diff --git a/client/src/app/+videos/+video-watch/player-styles.component.ts b/client/src/app/+videos/+video-watch/player-styles.component.ts index 9b1672a8c..448a0ee96 100644 --- a/client/src/app/+videos/+video-watch/player-styles.component.ts +++ b/client/src/app/+videos/+video-watch/player-styles.component.ts | |||
@@ -8,7 +8,7 @@ import { Component, ViewEncapsulation } from '@angular/core' | |||
8 | selector: 'my-player-styles', | 8 | selector: 'my-player-styles', |
9 | template: '', | 9 | template: '', |
10 | styleUrls: [ './player-styles.component.scss' ], | 10 | styleUrls: [ './player-styles.component.scss' ], |
11 | // tslint:disable:use-component-view-encapsulation | 11 | /* eslint-disable @angular-eslint/use-component-view-encapsulation */ |
12 | encapsulation: ViewEncapsulation.None | 12 | encapsulation: ViewEncapsulation.None |
13 | }) | 13 | }) |
14 | export class PlayerStylesComponent { | 14 | export class PlayerStylesComponent { |
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts index ac65f7260..71fb127f6 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts | |||
@@ -25,7 +25,7 @@ import { VideoCommentCreate } from '@shared/models' | |||
25 | @Component({ | 25 | @Component({ |
26 | selector: 'my-video-comment-add', | 26 | selector: 'my-video-comment-add', |
27 | templateUrl: './video-comment-add.component.html', | 27 | templateUrl: './video-comment-add.component.html', |
28 | styleUrls: ['./video-comment-add.component.scss'] | 28 | styleUrls: [ './video-comment-add.component.scss' ] |
29 | }) | 29 | }) |
30 | export class VideoCommentAddComponent extends FormReactive implements OnChanges, OnInit { | 30 | export class VideoCommentAddComponent extends FormReactive implements OnChanges, OnInit { |
31 | @Input() user: User | 31 | @Input() user: User |
@@ -64,7 +64,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, | |||
64 | for (const emojiMarkupName in emojiMarkupObjectList) { | 64 | for (const emojiMarkupName in emojiMarkupObjectList) { |
65 | if (emojiMarkupName) { | 65 | if (emojiMarkupName) { |
66 | const emoji = emojiMarkupObjectList[emojiMarkupName] | 66 | const emoji = emojiMarkupObjectList[emojiMarkupName] |
67 | emojiMarkupArrayList.push([emoji, emojiMarkupName]) | 67 | emojiMarkupArrayList.push([ emoji, emojiMarkupName ]) |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
@@ -91,7 +91,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, | |||
91 | // Not initialized yet | 91 | // Not initialized yet |
92 | if (!this.form) return | 92 | if (!this.form) return |
93 | 93 | ||
94 | if (changes.textValue && changes.textValue.currentValue && changes.textValue.currentValue !== changes.textValue.previousValue) { | 94 | if (changes.textValue?.currentValue && changes.textValue.currentValue !== changes.textValue.previousValue) { |
95 | this.patchTextValue(changes.textValue.currentValue, true) | 95 | this.patchTextValue(changes.textValue.currentValue, true) |
96 | } | 96 | } |
97 | } | 97 | } |
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.html b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.html index d8b944b35..d0e9bcd29 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.html +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.html | |||
@@ -29,7 +29,7 @@ | |||
29 | class="comment-html" | 29 | class="comment-html" |
30 | [innerHTML]="sanitizedCommentHTML" | 30 | [innerHTML]="sanitizedCommentHTML" |
31 | (timestampClicked)="handleTimestampClicked($event)" | 31 | (timestampClicked)="handleTimestampClicked($event)" |
32 | timestampRouteTransformer | 32 | myTimestampRouteTransformer |
33 | ></div> | 33 | ></div> |
34 | 34 | ||
35 | <div class="comment-actions"> | 35 | <div class="comment-actions"> |
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts index f858f4750..5bbcffe82 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts | |||
@@ -10,7 +10,7 @@ import { User, UserRight } from '@shared/models' | |||
10 | @Component({ | 10 | @Component({ |
11 | selector: 'my-video-comment', | 11 | selector: 'my-video-comment', |
12 | templateUrl: './video-comment.component.html', | 12 | templateUrl: './video-comment.component.html', |
13 | styleUrls: ['./video-comment.component.scss'] | 13 | styleUrls: [ './video-comment.component.scss' ] |
14 | }) | 14 | }) |
15 | export class VideoCommentComponent implements OnInit, OnChanges { | 15 | export class VideoCommentComponent implements OnInit, OnChanges { |
16 | @ViewChild('commentReportModal') commentReportModal: CommentReportComponent | 16 | @ViewChild('commentReportModal') commentReportModal: CommentReportComponent |
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts index 72866b874..17e0af3bc 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts | |||
@@ -9,7 +9,7 @@ import { VideoComment, VideoCommentService, VideoCommentThreadTree } from '@app/ | |||
9 | @Component({ | 9 | @Component({ |
10 | selector: 'my-video-comments', | 10 | selector: 'my-video-comments', |
11 | templateUrl: './video-comments.component.html', | 11 | templateUrl: './video-comments.component.html', |
12 | styleUrls: ['./video-comments.component.scss'] | 12 | styleUrls: [ './video-comments.component.scss' ] |
13 | }) | 13 | }) |
14 | export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | 14 | export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { |
15 | @ViewChild('commentHighlightBlock') commentHighlightBlock: ElementRef | 15 | @ViewChild('commentHighlightBlock') commentHighlightBlock: ElementRef |
@@ -200,7 +200,11 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
200 | } | 200 | } |
201 | 201 | ||
202 | async onWantedToRedraft (commentToRedraft: VideoComment) { | 202 | async onWantedToRedraft (commentToRedraft: VideoComment) { |
203 | const confirm = await this.onWantedToDelete(commentToRedraft, $localize`Delete and re-draft`, $localize`Do you really want to delete and re-draft this comment?`) | 203 | const confirm = await this.onWantedToDelete( |
204 | commentToRedraft, | ||
205 | $localize`Delete and re-draft`, | ||
206 | $localize`Do you really want to delete and re-draft this comment?` | ||
207 | ) | ||
204 | 208 | ||
205 | if (confirm) { | 209 | if (confirm) { |
206 | this.inReplyToCommentId = commentToRedraft.inReplyToCommentId | 210 | this.inReplyToCommentId = commentToRedraft.inReplyToCommentId |
diff --git a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts index 0072492ac..257d463b4 100644 --- a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts +++ b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts | |||
@@ -23,7 +23,7 @@ export class VideoAlertComponent { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | hasVideoScheduledPublication () { | 25 | hasVideoScheduledPublication () { |
26 | return this.video && this.video.scheduledUpdate !== undefined | 26 | return this.video?.scheduledUpdate !== undefined |
27 | } | 27 | } |
28 | 28 | ||
29 | isWaitingForLive () { | 29 | isWaitingForLive () { |
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html index 57f682899..2cfaad8f6 100644 --- a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html +++ b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html | |||
@@ -3,7 +3,7 @@ | |||
3 | class="video-info-description-html" | 3 | class="video-info-description-html" |
4 | [innerHTML]="videoHTMLDescription" | 4 | [innerHTML]="videoHTMLDescription" |
5 | (timestampClicked)="onTimestampClicked($event)" | 5 | (timestampClicked)="onTimestampClicked($event)" |
6 | timestampRouteTransformer | 6 | myTimestampRouteTransformer |
7 | ></div> | 7 | ></div> |
8 | 8 | ||
9 | <div class="video-info-description-more" *ngIf="completeDescriptionShown === false && video.description?.length >= 250" (click)="showMoreDescription()"> | 9 | <div class="video-info-description-more" *ngIf="completeDescriptionShown === false && video.description?.length >= 250" (click)="showMoreDescription()"> |
diff --git a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts index f0f7966b1..78b3af4a7 100644 --- a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts +++ b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts | |||
@@ -39,7 +39,7 @@ export class VideoWatchPlaylistComponent { | |||
39 | private notifier: Notifier, | 39 | private notifier: Notifier, |
40 | private videoPlaylist: VideoPlaylistService, | 40 | private videoPlaylist: VideoPlaylistService, |
41 | private localStorageService: LocalStorageService, | 41 | private localStorageService: LocalStorageService, |
42 | private sessionStorageService: SessionStorageService, | 42 | private sessionStorage: SessionStorageService, |
43 | private router: Router | 43 | private router: Router |
44 | ) { | 44 | ) { |
45 | // defaults to true | 45 | // defaults to true |
@@ -50,7 +50,7 @@ export class VideoWatchPlaylistComponent { | |||
50 | this.setAutoPlayNextVideoPlaylistSwitchText() | 50 | this.setAutoPlayNextVideoPlaylistSwitchText() |
51 | 51 | ||
52 | // defaults to false | 52 | // defaults to false |
53 | this.loopPlaylist = this.sessionStorageService.getItem(VideoWatchPlaylistComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true' | 53 | this.loopPlaylist = this.sessionStorage.getItem(VideoWatchPlaylistComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true' |
54 | this.setLoopPlaylistSwitchText() | 54 | this.setLoopPlaylistSwitchText() |
55 | } | 55 | } |
56 | 56 | ||
@@ -145,7 +145,7 @@ export class VideoWatchPlaylistComponent { | |||
145 | 145 | ||
146 | const start = previous.startTimestamp | 146 | const start = previous.startTimestamp |
147 | const stop = previous.stopTimestamp | 147 | const stop = previous.stopTimestamp |
148 | this.router.navigate([],{ queryParams: { playlistPosition: previous.position, start, stop } }) | 148 | this.router.navigate([], { queryParams: { playlistPosition: previous.position, start, stop } }) |
149 | } | 149 | } |
150 | 150 | ||
151 | findPlaylistVideo (position: number, type: 'previous' | 'next'): VideoPlaylistElement { | 151 | findPlaylistVideo (position: number, type: 'previous' | 'next'): VideoPlaylistElement { |
@@ -163,7 +163,7 @@ export class VideoWatchPlaylistComponent { | |||
163 | } | 163 | } |
164 | 164 | ||
165 | const found = this.playlistElements.find(e => e.position === position) | 165 | const found = this.playlistElements.find(e => e.position === position) |
166 | if (found && found.video) return found | 166 | if (found?.video) return found |
167 | 167 | ||
168 | const newPosition = type === 'previous' | 168 | const newPosition = type === 'previous' |
169 | ? position - 1 | 169 | ? position - 1 |
@@ -178,7 +178,7 @@ export class VideoWatchPlaylistComponent { | |||
178 | 178 | ||
179 | const start = next.startTimestamp | 179 | const start = next.startTimestamp |
180 | const stop = next.stopTimestamp | 180 | const stop = next.stopTimestamp |
181 | this.router.navigate([],{ queryParams: { playlistPosition: next.position, start, stop } }) | 181 | this.router.navigate([], { queryParams: { playlistPosition: next.position, start, stop } }) |
182 | } | 182 | } |
183 | 183 | ||
184 | switchAutoPlayNextVideoPlaylist () { | 184 | switchAutoPlayNextVideoPlaylist () { |
diff --git a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html index e1040fead..bbfcab2ae 100644 --- a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html +++ b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html | |||
@@ -20,7 +20,7 @@ | |||
20 | > | 20 | > |
21 | </my-video-miniature> | 21 | </my-video-miniature> |
22 | 22 | ||
23 | <hr *ngIf="!playlist && i == 0 && length > 1" /> | 23 | <hr *ngIf="!playlist && i === 0 && length > 1" /> |
24 | </ng-container> | 24 | </ng-container> |
25 | </ng-container> | 25 | </ng-container> |
26 | </div> | 26 | </div> |
diff --git a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts index 7f3703c08..dfc296d15 100644 --- a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts +++ b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts | |||
@@ -51,7 +51,7 @@ export class RecommendedVideosComponent implements OnInit, OnChanges { | |||
51 | } else { | 51 | } else { |
52 | this.autoPlayNextVideo = this.sessionStorageService.getItem(UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' | 52 | this.autoPlayNextVideo = this.sessionStorageService.getItem(UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' |
53 | 53 | ||
54 | this.sessionStorageService.watch([UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO]).subscribe( | 54 | this.sessionStorageService.watch([ UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO ]).subscribe( |
55 | () => { | 55 | () => { |
56 | this.autoPlayNextVideo = this.sessionStorageService.getItem(UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' | 56 | this.autoPlayNextVideo = this.sessionStorageService.getItem(UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' |
57 | } | 57 | } |
diff --git a/client/src/app/+videos/+video-watch/shared/timestamp-route-transformer.directive.ts b/client/src/app/+videos/+video-watch/shared/timestamp-route-transformer.directive.ts index 45e023695..91fe5bf5d 100644 --- a/client/src/app/+videos/+video-watch/shared/timestamp-route-transformer.directive.ts +++ b/client/src/app/+videos/+video-watch/shared/timestamp-route-transformer.directive.ts | |||
@@ -1,12 +1,12 @@ | |||
1 | import { Directive, EventEmitter, HostListener, Output } from '@angular/core' | 1 | import { Directive, EventEmitter, HostListener, Output } from '@angular/core' |
2 | 2 | ||
3 | @Directive({ | 3 | @Directive({ |
4 | selector: '[timestampRouteTransformer]' | 4 | selector: '[myTimestampRouteTransformer]' |
5 | }) | 5 | }) |
6 | export class TimestampRouteTransformerDirective { | 6 | export class TimestampRouteTransformerDirective { |
7 | @Output() timestampClicked = new EventEmitter<number>() | 7 | @Output() timestampClicked = new EventEmitter<number>() |
8 | 8 | ||
9 | @HostListener('click', ['$event']) | 9 | @HostListener('click', [ '$event' ]) |
10 | public onClick ($event: Event) { | 10 | public onClick ($event: Event) { |
11 | const target = $event.target as HTMLLinkElement | 11 | const target = $event.target as HTMLLinkElement |
12 | 12 | ||
@@ -21,10 +21,10 @@ export class TimestampRouteTransformerDirective { | |||
21 | const ngxLinkParams = new URLSearchParams(ngxLink.search) | 21 | const ngxLinkParams = new URLSearchParams(ngxLink.search) |
22 | if (ngxLinkParams.has('start') !== true) return | 22 | if (ngxLinkParams.has('start') !== true) return |
23 | 23 | ||
24 | const separators = ['h', 'm', 's'] | 24 | const separators = [ 'h', 'm', 's' ] |
25 | const start = ngxLinkParams | 25 | const start = ngxLinkParams |
26 | .get('start') | 26 | .get('start') |
27 | .match(new RegExp('(\\d{1,9}[' + separators.join('') + '])','g')) // match digits before any given separator | 27 | .match(new RegExp('(\\d{1,9}[' + separators.join('') + '])', 'g')) // match digits before any given separator |
28 | .map(t => { | 28 | .map(t => { |
29 | if (t.includes('h')) return parseInt(t, 10) * 3600 | 29 | if (t.includes('h')) return parseInt(t, 10) * 3600 |
30 | if (t.includes('m')) return parseInt(t, 10) * 60 | 30 | if (t.includes('m')) return parseInt(t, 10) * 60 |
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index 85100b653..2007bdecb 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -195,10 +195,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
195 | 195 | ||
196 | private loadRouteParams () { | 196 | private loadRouteParams () { |
197 | this.paramsSub = this.route.params.subscribe(routeParams => { | 197 | this.paramsSub = this.route.params.subscribe(routeParams => { |
198 | const videoId = routeParams[ 'videoId' ] | 198 | const videoId = routeParams['videoId'] |
199 | if (videoId) return this.loadVideo(videoId) | 199 | if (videoId) return this.loadVideo(videoId) |
200 | 200 | ||
201 | const playlistId = routeParams[ 'playlistId' ] | 201 | const playlistId = routeParams['playlistId'] |
202 | if (playlistId) return this.loadPlaylist(playlistId) | 202 | if (playlistId) return this.loadPlaylist(playlistId) |
203 | }) | 203 | }) |
204 | } | 204 | } |
@@ -206,7 +206,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
206 | private loadRouteQuery () { | 206 | private loadRouteQuery () { |
207 | this.queryParamsSub = this.route.queryParams.subscribe(queryParams => { | 207 | this.queryParamsSub = this.route.queryParams.subscribe(queryParams => { |
208 | // Handle the ?playlistPosition | 208 | // Handle the ?playlistPosition |
209 | const positionParam = queryParams[ 'playlistPosition' ] ?? 1 | 209 | const positionParam = queryParams['playlistPosition'] ?? 1 |
210 | 210 | ||
211 | this.playlistPosition = positionParam === 'last' | 211 | this.playlistPosition = positionParam === 'last' |
212 | ? -1 // Handle the "last" index | 212 | ? -1 // Handle the "last" index |
@@ -219,7 +219,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
219 | 219 | ||
220 | this.videoWatchPlaylist.updatePlaylistIndex(this.playlistPosition) | 220 | this.videoWatchPlaylist.updatePlaylistIndex(this.playlistPosition) |
221 | 221 | ||
222 | const start = queryParams[ 'start' ] | 222 | const start = queryParams['start'] |
223 | if (this.player && start) this.player.currentTime(parseInt(start, 10)) | 223 | if (this.player && start) this.player.currentTime(parseInt(start, 10)) |
224 | }) | 224 | }) |
225 | } | 225 | } |
@@ -237,7 +237,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
237 | 'filter:api.video-watch.video.get.result' | 237 | 'filter:api.video-watch.video.get.result' |
238 | ) | 238 | ) |
239 | 239 | ||
240 | forkJoin([ videoObs, this.videoCaptionService.listCaptions(videoId)]) | 240 | forkJoin([ videoObs, this.videoCaptionService.listCaptions(videoId) ]) |
241 | .subscribe({ | 241 | .subscribe({ |
242 | next: ([ video, captionsResult ]) => { | 242 | next: ([ video, captionsResult ]) => { |
243 | const queryParams = this.route.snapshot.queryParams | 243 | const queryParams = this.route.snapshot.queryParams |
@@ -292,6 +292,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
292 | const originUrl = errorBody.originUrl + (window.location.search ?? '') | 292 | const originUrl = errorBody.originUrl + (window.location.search ?? '') |
293 | 293 | ||
294 | const res = await this.confirmService.confirm( | 294 | const res = await this.confirmService.confirm( |
295 | // eslint-disable-next-line max-len | ||
295 | $localize`This video is not available on this instance. Do you want to be redirected on the origin instance: <a href="${originUrl}">${originUrl}</a>?`, | 296 | $localize`This video is not available on this instance. Do you want to be redirected on the origin instance: <a href="${originUrl}">${originUrl}</a>?`, |
296 | $localize`Redirection` | 297 | $localize`Redirection` |
297 | ) | 298 | ) |
@@ -312,7 +313,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
312 | if (!errorMessage) return | 313 | if (!errorMessage) return |
313 | 314 | ||
314 | // Display a message in the video player instead of a notification | 315 | // Display a message in the video player instead of a notification |
315 | if (errorMessage.indexOf('from xs param') !== -1) { | 316 | if (errorMessage.includes('from xs param')) { |
316 | this.flushPlayer() | 317 | this.flushPlayer() |
317 | this.remoteServerDown = true | 318 | this.remoteServerDown = true |
318 | 319 | ||
@@ -466,7 +467,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
466 | 467 | ||
467 | if (this.nextVideoUUID) { | 468 | if (this.nextVideoUUID) { |
468 | this.router.navigate([ '/w', this.nextVideoUUID ]) | 469 | this.router.navigate([ '/w', this.nextVideoUUID ]) |
469 | return | ||
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
@@ -483,14 +483,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
483 | 483 | ||
484 | private isAutoPlayNext () { | 484 | private isAutoPlayNext () { |
485 | return ( | 485 | return ( |
486 | (this.user && this.user.autoPlayNextVideo) || | 486 | (this.user?.autoPlayNextVideo) || |
487 | this.anonymousUser.autoPlayNextVideo | 487 | this.anonymousUser.autoPlayNextVideo |
488 | ) | 488 | ) |
489 | } | 489 | } |
490 | 490 | ||
491 | private isPlaylistAutoPlayNext () { | 491 | private isPlaylistAutoPlayNext () { |
492 | return ( | 492 | return ( |
493 | (this.user && this.user.autoPlayNextVideoPlaylist) || | 493 | (this.user?.autoPlayNextVideoPlaylist) || |
494 | this.anonymousUser.autoPlayNextVideoPlaylist | 494 | this.anonymousUser.autoPlayNextVideoPlaylist |
495 | ) | 495 | ) |
496 | } | 496 | } |
@@ -508,9 +508,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
508 | } | 508 | } |
509 | 509 | ||
510 | private buildPlayerManagerOptions (params: { | 510 | private buildPlayerManagerOptions (params: { |
511 | video: VideoDetails, | 511 | video: VideoDetails |
512 | videoCaptions: VideoCaption[], | 512 | videoCaptions: VideoCaption[] |
513 | urlOptions: CustomizationOptions & { playerMode: PlayerMode }, | 513 | urlOptions: CustomizationOptions & { playerMode: PlayerMode } |
514 | user?: AuthUser | 514 | user?: AuthUser |
515 | }) { | 515 | }) { |
516 | const { video, videoCaptions, urlOptions, user } = params | 516 | const { video, videoCaptions, urlOptions, user } = params |
@@ -573,10 +573,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
573 | 573 | ||
574 | language: this.localeId, | 574 | language: this.localeId, |
575 | 575 | ||
576 | userWatching: user && user.videosHistoryEnabled === true ? { | 576 | userWatching: user && user.videosHistoryEnabled === true |
577 | url: this.videoService.getUserWatchingVideoUrl(video.uuid), | 577 | ? { |
578 | authorizationHeader: this.authService.getRequestHeaderValue() | 578 | url: this.videoService.getUserWatchingVideoUrl(video.uuid), |
579 | } : undefined, | 579 | authorizationHeader: this.authService.getRequestHeaderValue() |
580 | } | ||
581 | : undefined, | ||
580 | 582 | ||
581 | serverUrl: environment.apiUrl, | 583 | serverUrl: environment.apiUrl, |
582 | 584 | ||
@@ -704,9 +706,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
704 | if (this.isUserLoggedIn()) { | 706 | if (this.isUserLoggedIn()) { |
705 | this.hotkeys = this.hotkeys.concat([ | 707 | this.hotkeys = this.hotkeys.concat([ |
706 | new Hotkey('shift+s', () => { | 708 | new Hotkey('shift+s', () => { |
707 | this.subscribeButton.isSubscribedToAll() | 709 | if (this.subscribeButton.isSubscribedToAll()) this.subscribeButton.unsubscribe() |
708 | ? this.subscribeButton.unsubscribe() | 710 | else this.subscribeButton.subscribe() |
709 | : this.subscribeButton.subscribe() | ||
710 | 711 | ||
711 | return false | 712 | return false |
712 | }, undefined, $localize`Subscribe to the account`) | 713 | }, undefined, $localize`Subscribe to the account`) |