From 1378c0d343028f3d40d7d795422684ab9e6a1599 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 Aug 2021 11:27:47 +0200 Subject: Fix client lint --- .../shared/action-buttons/video-rate.component.ts | 16 ++++----- .../shared/comment/video-comment-add.component.ts | 8 ++--- .../shared/comment/video-comment.component.ts | 8 ++--- .../shared/comment/video-comments.component.ts | 42 +++++++++++----------- .../shared/metadata/video-description.component.ts | 10 +++--- .../playlist/video-watch-playlist.component.ts | 15 ++++---- .../recommended-videos.component.ts | 14 ++++---- .../+videos/+video-watch/video-watch.component.ts | 16 ++++----- 8 files changed, 66 insertions(+), 63 deletions(-) (limited to 'client/src/app/+videos/+video-watch') diff --git a/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts b/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts index ecb5a9281..48d48f33f 100644 --- a/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts +++ b/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts @@ -90,16 +90,16 @@ export class VideoRateComponent implements OnInit, OnChanges, OnDestroy { if (this.isUserLoggedIn === false) return this.videoService.getUserVideoRating(this.video.id) - .subscribe( - ratingObject => { + .subscribe({ + next: ratingObject => { if (!ratingObject) return this.userRating = ratingObject.rating this.userRatingLoaded.emit(this.userRating) }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } private setRating (nextRating: UserVideoRateType) { @@ -110,16 +110,16 @@ export class VideoRateComponent implements OnInit, OnChanges, OnDestroy { } ratingMethods[nextRating].call(this.videoService, this.video.id) - .subscribe( - () => { + .subscribe({ + next: () => { // Update the video like attribute this.updateVideoRating(this.userRating, nextRating) this.userRating = nextRating this.rateUpdated.emit(this.userRating) }, - (err: { message: string }) => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } private updateVideoRating (oldRating: UserVideoRateType, newRating: UserVideoRateType) { 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 78efe1684..ac65f7260 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 @@ -137,19 +137,19 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, obs = this.addCommentThread(commentCreate) } - obs.subscribe( - comment => { + obs.subscribe({ + next: comment => { this.addingComment = false this.commentCreated.emit(comment) this.form.reset() }, - err => { + error: err => { this.addingComment = false this.notifier.error(err.text) } - ) + }) } isAddButtonDisplayed () { 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 0e1c4c207..f858f4750 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 @@ -149,11 +149,11 @@ export class VideoCommentComponent implements OnInit, OnChanges { const user = this.authService.getUser() if (user.hasRight(UserRight.MANAGE_USERS)) { this.userService.getUserWithCache(account.userId) - .subscribe( - user => this.commentUser = user, + .subscribe({ + next: user => this.commentUser = user, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } } 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 2c39e63fb..72866b874 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 @@ -90,22 +90,22 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { 'filter:api.video-watch.video-thread-replies.list.result' ) - obs.subscribe( - res => { - this.threadComments[commentId] = res - this.threadLoading[commentId] = false - this.hooks.runAction('action:video-watch.video-thread-replies.loaded', 'video-watch', { data: res }) + obs.subscribe({ + next: res => { + this.threadComments[commentId] = res + this.threadLoading[commentId] = false + this.hooks.runAction('action:video-watch.video-thread-replies.loaded', 'video-watch', { data: res }) - if (highlightThread) { - this.highlightedThread = new VideoComment(res.comment) + if (highlightThread) { + this.highlightedThread = new VideoComment(res.comment) - // Scroll to the highlighted thread - setTimeout(() => this.commentHighlightBlock.nativeElement.scrollIntoView(), 0) - } - }, + // Scroll to the highlighted thread + setTimeout(() => this.commentHighlightBlock.nativeElement.scrollIntoView(), 0) + } + }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } loadMoreThreads () { @@ -123,8 +123,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { 'filter:api.video-watch.video-threads.list.result' ) - obs.subscribe( - res => { + obs.subscribe({ + next: res => { this.comments = this.comments.concat(res.data) this.componentPagination.totalItems = res.total this.totalNotDeletedComments = res.totalNotDeletedComments @@ -133,8 +133,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { this.hooks.runAction('action:video-watch.video-threads.loaded', 'video-watch', { data: this.componentPagination }) }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } onCommentThreadCreated (comment: VideoComment) { @@ -181,8 +181,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { if (res === false) return false this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id) - .subscribe( - () => { + .subscribe({ + next: () => { if (this.highlightedThread?.id === commentToDelete.id) { commentToDelete = this.comments.find(c => c.id === commentToDelete.id) @@ -193,8 +193,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { this.softDeleteComment(commentToDelete) }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) return true } diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts index 870c7ae3f..e002b3c22 100644 --- a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts +++ b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts @@ -50,8 +50,8 @@ export class VideoDescriptionComponent implements OnChanges { this.descriptionLoading = true this.videoService.loadCompleteDescription(this.video.descriptionPath) - .subscribe( - description => { + .subscribe({ + next: description => { this.completeDescriptionShown = true this.descriptionLoading = false @@ -61,11 +61,11 @@ export class VideoDescriptionComponent implements OnChanges { this.updateVideoDescription(this.completeVideoDescription) }, - error => { + error: err => { this.descriptionLoading = false - this.notifier.error(error.message) + this.notifier.error(err.message) } - ) + }) } onTimestampClicked (timestamp: number) { 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 8b3ed4964..f0f7966b1 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 @@ -1,4 +1,3 @@ - import { Component, EventEmitter, Input, Output } from '@angular/core' import { Router } from '@angular/router' import { AuthService, ComponentPagination, LocalStorageService, Notifier, SessionStorageService, UserService } from '@app/core' @@ -196,12 +195,14 @@ export class VideoWatchPlaylistComponent { autoPlayNextVideoPlaylist: this.autoPlayNextVideoPlaylist } - this.userService.updateMyProfile(details).subscribe( - () => { - this.auth.refreshUserInformation() - }, - err => this.notifier.error(err.message) - ) + this.userService.updateMyProfile(details) + .subscribe({ + next: () => { + this.auth.refreshUserInformation() + }, + + error: err => this.notifier.error(err.message) + }) } } 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 89b9c01b6..7f3703c08 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 @@ -84,12 +84,14 @@ export class RecommendedVideosComponent implements OnInit, OnChanges { autoPlayNextVideo: this.autoPlayNextVideo } - this.userService.updateMyProfile(details).subscribe( - () => { - this.authService.refreshUserInformation() - }, - err => this.notifier.error(err.message) - ) + this.userService.updateMyProfile(details) + .subscribe({ + next: () => { + this.authService.refreshUserInformation() + }, + + error: err => this.notifier.error(err.message) + }) } } } 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 ccb9c5e71..85100b653 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -238,8 +238,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { ) forkJoin([ videoObs, this.videoCaptionService.listCaptions(videoId)]) - .subscribe( - ([ video, captionsResult ]) => { + .subscribe({ + next: ([ video, captionsResult ]) => { const queryParams = this.route.snapshot.queryParams const urlOptions = { @@ -260,23 +260,23 @@ export class VideoWatchComponent implements OnInit, OnDestroy { .catch(err => this.handleGlobalError(err)) }, - err => this.handleRequestError(err) - ) + error: err => this.handleRequestError(err) + }) } private loadPlaylist (playlistId: string) { if (this.isSameElement(this.playlist, playlistId)) return this.playlistService.getVideoPlaylist(playlistId) - .subscribe( - playlist => { + .subscribe({ + next: playlist => { this.playlist = playlist this.videoWatchPlaylist.loadPlaylistElements(playlist, !this.playlistPosition, this.playlistPosition) }, - err => this.handleRequestError(err) - ) + error: err => this.handleRequestError(err) + }) } private isSameElement (element: VideoDetails | VideoPlaylist, newId: string) { -- cgit v1.2.3