From 1378c0d343028f3d40d7d795422684ab9e6a1599 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 Aug 2021 11:27:47 +0200 Subject: Fix client lint --- .../my-video-channel-create.component.ts | 8 +-- .../my-video-channel-update.component.ts | 78 +++++++++++----------- .../my-video-channels.component.ts | 8 +-- .../+my-library/my-history/my-history.component.ts | 16 ++--- .../my-accept-ownership.component.ts | 8 +-- .../my-ownership/my-ownership.component.ts | 16 ++--- .../my-subscriptions/my-subscriptions.component.ts | 8 +-- .../my-video-imports/my-video-imports.component.ts | 8 +-- .../my-video-playlist-create.component.ts | 15 +++-- .../my-video-playlist-elements.component.ts | 16 ++--- .../my-video-playlist-update.component.ts | 23 ++++--- .../my-video-playlists.component.ts | 8 +-- .../modals/video-change-ownership.component.ts | 16 ++--- .../+my-library/my-videos/my-videos.component.ts | 16 ++--- 14 files changed, 124 insertions(+), 120 deletions(-) (limited to 'client/src/app/+my-library') diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts b/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts index 433475f66..d983aacd9 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts +++ b/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts @@ -59,15 +59,15 @@ export class MyVideoChannelCreateComponent extends MyVideoChannelEdit implements .pipe( switchMap(() => this.uploadAvatar()), switchMap(() => this.uploadBanner()) - ).subscribe( - () => { + ).subscribe({ + next: () => { this.authService.refreshUserInformation() this.notifier.success($localize`Video channel ${videoChannelCreate.displayName} created.`) this.router.navigate(['/my-library', 'video-channels']) }, - err => { + error: err => { if (err.status === HttpStatusCode.CONFLICT_409) { this.error = $localize`This name already exists on this instance.` return @@ -75,7 +75,7 @@ export class MyVideoChannelCreateComponent extends MyVideoChannelEdit implements this.error = err.message } - ) + }) } onAvatarChange (formData: FormData) { diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts b/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts index eb24a60c5..e8bfbf9ce 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts +++ b/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts @@ -52,21 +52,22 @@ export class MyVideoChannelUpdateComponent extends MyVideoChannelEdit implements this.paramsSub = this.route.params.subscribe(routeParams => { const videoChannelId = routeParams['videoChannelId'] - this.videoChannelService.getVideoChannel(videoChannelId).subscribe( - videoChannelToUpdate => { - this.videoChannel = videoChannelToUpdate - - this.oldSupportField = videoChannelToUpdate.support - - this.form.patchValue({ - 'display-name': videoChannelToUpdate.displayName, - description: videoChannelToUpdate.description, - support: videoChannelToUpdate.support - }) - }, + this.videoChannelService.getVideoChannel(videoChannelId) + .subscribe({ + next: videoChannelToUpdate => { + this.videoChannel = videoChannelToUpdate + + this.oldSupportField = videoChannelToUpdate.support + + this.form.patchValue({ + 'display-name': videoChannelToUpdate.displayName, + description: videoChannelToUpdate.description, + support: videoChannelToUpdate.support + }) + }, - err => this.error = err.message - ) + error: err => this.error = err.message + }) }) } @@ -85,77 +86,78 @@ export class MyVideoChannelUpdateComponent extends MyVideoChannelEdit implements bulkVideosSupportUpdate: body.bulkVideosSupportUpdate || false } - this.videoChannelService.updateVideoChannel(this.videoChannel.name, videoChannelUpdate).subscribe( - () => { - this.authService.refreshUserInformation() + this.videoChannelService.updateVideoChannel(this.videoChannel.name, videoChannelUpdate) + .subscribe({ + next: () => { + this.authService.refreshUserInformation() - this.notifier.success($localize`Video channel ${videoChannelUpdate.displayName} updated.`) + this.notifier.success($localize`Video channel ${videoChannelUpdate.displayName} updated.`) - this.router.navigate([ '/my-library', 'video-channels' ]) - }, + this.router.navigate([ '/my-library', 'video-channels' ]) + }, - err => this.error = err.message - ) + error: err => this.error = err.message + }) } onAvatarChange (formData: FormData) { this.videoChannelService.changeVideoChannelImage(this.videoChannel.name, formData, 'avatar') - .subscribe( - data => { + .subscribe({ + next: data => { this.notifier.success($localize`Avatar changed.`) this.videoChannel.updateAvatar(data.avatar) }, - (err: HttpErrorResponse) => genericUploadErrorHandler({ + error: (err: HttpErrorResponse) => genericUploadErrorHandler({ err, name: $localize`avatar`, notifier: this.notifier }) - ) + }) } onAvatarDelete () { this.videoChannelService.deleteVideoChannelImage(this.videoChannel.name, 'avatar') - .subscribe( - data => { + .subscribe({ + next: () => { this.notifier.success($localize`Avatar deleted.`) this.videoChannel.resetAvatar() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } onBannerChange (formData: FormData) { this.videoChannelService.changeVideoChannelImage(this.videoChannel.name, formData, 'banner') - .subscribe( - data => { + .subscribe({ + next: data => { this.notifier.success($localize`Banner changed.`) this.videoChannel.updateBanner(data.banner) }, - (err: HttpErrorResponse) => genericUploadErrorHandler({ + error: (err: HttpErrorResponse) => genericUploadErrorHandler({ err, name: $localize`banner`, notifier: this.notifier }) - ) + }) } onBannerDelete () { this.videoChannelService.deleteVideoChannelImage(this.videoChannel.name, 'banner') - .subscribe( - data => { + .subscribe({ + next: () => { this.notifier.success($localize`Banner deleted.`) this.videoChannel.resetBanner() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } get maxAvatarSize () { diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts index b6a2f592d..8b665fd58 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts +++ b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts @@ -54,14 +54,14 @@ channel with the same name (${videoChannel.name})!`, if (res === false) return this.videoChannelService.removeVideoChannel(videoChannel) - .subscribe( - () => { + .subscribe({ + next: () => { this.loadVideoChannels() this.notifier.success($localize`Video channel ${videoChannel.displayName} deleted.`) }, - error => this.notifier.error(error.message) - ) + error: err => this.notifier.error(err.message) + }) } private loadVideoChannels () { diff --git a/client/src/app/+my-library/my-history/my-history.component.ts b/client/src/app/+my-library/my-history/my-history.component.ts index ad83db7ab..fe6e86346 100644 --- a/client/src/app/+my-library/my-history/my-history.component.ts +++ b/client/src/app/+my-library/my-history/my-history.component.ts @@ -107,8 +107,8 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook { onVideosHistoryChange () { this.userService.updateMyProfile({ videosHistoryEnabled: this.videosHistoryEnabled }) - .subscribe( - () => { + .subscribe({ + next: () => { const message = this.videosHistoryEnabled === true ? $localize`Videos history is enabled` : $localize`Videos history is disabled` @@ -118,8 +118,8 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook { this.authService.refreshUserInformation() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } async deleteHistory () { @@ -130,14 +130,14 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook { if (res !== true) return this.userHistoryService.deleteUserVideosHistory() - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Videos history deleted`) this.reloadData() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } } diff --git a/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts b/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts index 7889d0985..b92377bca 100644 --- a/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts +++ b/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts @@ -64,14 +64,14 @@ export class MyAcceptOwnershipComponent extends FormReactive implements OnInit { const videoChangeOwnership = this.videoChangeOwnership this.videoOwnershipService .acceptOwnership(videoChangeOwnership.id, { channelId: channel }) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Ownership accepted`) if (this.accepted) this.accepted.emit() this.videoChangeOwnership = undefined }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } } diff --git a/client/src/app/+my-library/my-ownership/my-ownership.component.ts b/client/src/app/+my-library/my-ownership/my-ownership.component.ts index aaf028474..7ea940ceb 100644 --- a/client/src/app/+my-library/my-ownership/my-ownership.component.ts +++ b/client/src/app/+my-library/my-ownership/my-ownership.component.ts @@ -53,16 +53,16 @@ export class MyOwnershipComponent extends RestTable implements OnInit { refuse (videoChangeOwnership: VideoChangeOwnership) { this.videoOwnershipService.refuseOwnership(videoChangeOwnership.id) - .subscribe( - () => this.reloadData(), - err => this.notifier.error(err.message) - ) + .subscribe({ + next: () => this.reloadData(), + error: err => this.notifier.error(err.message) + }) } protected reloadData () { return this.videoOwnershipService.getOwnershipChanges(this.pagination, this.sort) - .subscribe( - resultList => { + .subscribe({ + next: resultList => { this.videoChangeOwnerships = resultList.data.map(change => ({ ...change, initiatorAccount: new Account(change.initiatorAccount), @@ -71,7 +71,7 @@ export class MyOwnershipComponent extends RestTable implements OnInit { this.totalRecords = resultList.total }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } } diff --git a/client/src/app/+my-library/my-subscriptions/my-subscriptions.component.ts b/client/src/app/+my-library/my-subscriptions/my-subscriptions.component.ts index 1f4a931a0..f676aa014 100644 --- a/client/src/app/+my-library/my-subscriptions/my-subscriptions.component.ts +++ b/client/src/app/+my-library/my-subscriptions/my-subscriptions.component.ts @@ -41,8 +41,8 @@ export class MySubscriptionsComponent { private loadSubscriptions (more = true) { this.userSubscriptionService.listSubscriptions({ pagination: this.pagination, search: this.search }) - .subscribe( - res => { + .subscribe({ + next: res => { this.videoChannels = more ? this.videoChannels.concat(res.data) : res.data @@ -51,7 +51,7 @@ export class MySubscriptionsComponent { this.onDataSubject.next(res.data) }, - error => this.notifier.error(error.message) - ) + error: err => this.notifier.error(err.message) + }) } } diff --git a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts index 68254526a..914785bf7 100644 --- a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts +++ b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts @@ -64,13 +64,13 @@ export class MyVideoImportsComponent extends RestTable implements OnInit { protected reloadData () { this.videoImportService.getMyVideoImports(this.pagination, this.sort) - .subscribe( - resultList => { + .subscribe({ + next: resultList => { this.videoImports = resultList.data this.totalRecords = resultList.total }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } } diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-create.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-create.component.ts index 8606a875a..3e3c3c878 100644 --- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-create.component.ts +++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-create.component.ts @@ -71,14 +71,15 @@ export class MyVideoPlaylistCreateComponent extends MyVideoPlaylistEdit implemen thumbnailfile: body.thumbnailfile || null } - this.videoPlaylistService.createVideoPlaylist(videoPlaylistCreate).subscribe( - () => { - this.notifier.success($localize`Playlist ${videoPlaylistCreate.displayName} created.`) - this.router.navigate([ '/my-library', 'video-playlists' ]) - }, + this.videoPlaylistService.createVideoPlaylist(videoPlaylistCreate) + .subscribe({ + next: () => { + this.notifier.success($localize`Playlist ${videoPlaylistCreate.displayName} created.`) + this.router.navigate([ '/my-library', 'video-playlists' ]) + }, - err => this.error = err.message - ) + error: err => this.error = err.message + }) } isCreation () { diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts index 86fe70710..6aff5dbd7 100644 --- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts +++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts @@ -85,13 +85,13 @@ export class MyVideoPlaylistElementsComponent implements OnInit, OnDestroy { this.playlistElements.splice(newIndex, 0, element) this.videoPlaylistService.reorderPlaylist(this.playlist.id, oldPosition, insertAfter) - .subscribe( - () => { + .subscribe({ + next: () => { this.reorderClientPositions() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } onElementRemoved (element: VideoPlaylistElement) { @@ -129,14 +129,14 @@ export class MyVideoPlaylistElementsComponent implements OnInit, OnDestroy { if (res === false) return this.videoPlaylistService.removeVideoPlaylist(videoPlaylist) - .subscribe( - () => { + .subscribe({ + next: () => { this.router.navigate([ '/my-library', 'video-playlists' ]) this.notifier.success($localize`Playlist ${videoPlaylist.displayName} deleted.`) }, - error => this.notifier.error(error.message) - ) + error: err => this.notifier.error(err.message) + }) } /** diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts index c554d3772..a3f54279b 100644 --- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts +++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts @@ -64,16 +64,16 @@ export class MyVideoPlaylistUpdateComponent extends MyVideoPlaylistEdit implemen ]) }) ) - .subscribe( - ([ videoPlaylistToUpdate, videoPlaylistPrivacies]) => { + .subscribe({ + next: ([ videoPlaylistToUpdate, videoPlaylistPrivacies]) => { this.videoPlaylistToUpdate = videoPlaylistToUpdate this.videoPlaylistPrivacies = videoPlaylistPrivacies this.hydrateFormFromPlaylist() }, - err => this.error = err.message - ) + error: err => this.error = err.message + }) } ngOnDestroy () { @@ -92,14 +92,15 @@ export class MyVideoPlaylistUpdateComponent extends MyVideoPlaylistEdit implemen thumbnailfile: body.thumbnailfile || undefined } - this.videoPlaylistService.updateVideoPlaylist(this.videoPlaylistToUpdate, videoPlaylistUpdate).subscribe( - () => { - this.notifier.success($localize`Playlist ${videoPlaylistUpdate.displayName} updated.`) - this.router.navigate([ '/my-library', 'video-playlists' ]) - }, + this.videoPlaylistService.updateVideoPlaylist(this.videoPlaylistToUpdate, videoPlaylistUpdate) + .subscribe({ + next: () => { + this.notifier.success($localize`Playlist ${videoPlaylistUpdate.displayName} updated.`) + this.router.navigate([ '/my-library', 'video-playlists' ]) + }, - err => this.error = err.message - ) + error: err => this.error = err.message + }) } isCreation () { diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts index d90102693..f0e4c348b 100644 --- a/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts +++ b/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts @@ -37,16 +37,16 @@ export class MyVideoPlaylistsComponent { if (res === false) return this.videoPlaylistService.removeVideoPlaylist(videoPlaylist) - .subscribe( - () => { + .subscribe({ + next: () => { this.videoPlaylists = this.videoPlaylists .filter(p => p.id !== videoPlaylist.id) this.notifier.success($localize`Playlist ${videoPlaylist.displayName}} deleted.`) }, - error => this.notifier.error(error.message) - ) + error: err => this.notifier.error(err.message) + }) } isRegularPlaylist (playlist: VideoPlaylist) { diff --git a/client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts b/client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts index 84237dee1..8c1f94bf3 100644 --- a/client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts +++ b/client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts @@ -48,11 +48,11 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni search (event: { query: string }) { const query = event.query this.userService.autocomplete(query) - .subscribe( - usernames => this.usernamePropositions = usernames, + .subscribe({ + next: usernames => this.usernamePropositions = usernames, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } changeOwnership () { @@ -60,10 +60,10 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni this.videoOwnershipService .changeOwnership(this.video.id, username) - .subscribe( - () => this.notifier.success($localize`Ownership change request sent.`), + .subscribe({ + next: () => this.notifier.success($localize`Ownership change request sent.`), - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } } diff --git a/client/src/app/+my-library/my-videos/my-videos.component.ts b/client/src/app/+my-library/my-videos/my-videos.component.ts index 1e4a4406d..4f9b71cc6 100644 --- a/client/src/app/+my-library/my-videos/my-videos.component.ts +++ b/client/src/app/+my-library/my-videos/my-videos.component.ts @@ -126,14 +126,14 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook { concat(...observables) .pipe(toArray()) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`${toDeleteVideosIds.length} videos deleted.`) this.selection = {} }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } async deleteVideo (video: Video) { @@ -144,14 +144,14 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook { if (res === false) return this.videoService.removeVideo(video.id) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Video ${video.name} deleted.`) this.removeVideoFromArray(video.id) }, - error => this.notifier.error(error.message) - ) + error: err => this.notifier.error(err.message) + }) } changeOwnership (video: Video) { -- cgit v1.2.3