]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix client lint
authorChocobozzz <me@florianbigard.com>
Tue, 17 Aug 2021 09:27:47 +0000 (11:27 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 17 Aug 2021 12:01:45 +0000 (14:01 +0200)
102 files changed:
client/src/app/+about/about-follows/about-follows.component.ts
client/src/app/+about/about-instance/contact-admin-modal.component.ts
client/src/app/+accounts/accounts.component.ts
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
client/src/app/+admin/follows/followers-list/followers-list.component.ts
client/src/app/+admin/follows/following-list/follow-modal.component.ts
client/src/app/+admin/follows/following-list/following-list.component.ts
client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts
client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html
client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts
client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts
client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts
client/src/app/+admin/system/debug/debug.component.ts
client/src/app/+admin/system/jobs/jobs.component.ts
client/src/app/+admin/system/logs/logs.component.ts
client/src/app/+admin/users/user-edit/user-create.component.ts
client/src/app/+admin/users/user-edit/user-password.component.ts
client/src/app/+admin/users/user-edit/user-update.component.ts
client/src/app/+admin/users/user-list/user-list.component.ts
client/src/app/+login/login.component.ts
client/src/app/+my-account/my-account-applications/my-account-applications.component.ts
client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts
client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts
client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts
client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts
client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts
client/src/app/+my-account/my-account-settings/my-account-settings.component.ts
client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts
client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts
client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts
client/src/app/+my-library/my-history/my-history.component.ts
client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts
client/src/app/+my-library/my-ownership/my-ownership.component.ts
client/src/app/+my-library/my-subscriptions/my-subscriptions.component.ts
client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
client/src/app/+my-library/my-video-playlists/my-video-playlist-create.component.ts
client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts
client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts
client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts
client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts
client/src/app/+my-library/my-videos/my-videos.component.ts
client/src/app/+reset-password/reset-password.component.ts
client/src/app/+search/search.component.ts
client/src/app/+signup/+register/register.component.ts
client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts
client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts
client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts
client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts
client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts
client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
client/src/app/+videos/+video-edit/video-update.component.ts
client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts
client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts
client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts
client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts
client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts
client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts
client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts
client/src/app/+videos/+video-watch/video-watch.component.ts
client/src/app/+videos/video-list/overview/video-overview.component.ts
client/src/app/+videos/video-list/video-user-subscriptions.component.ts
client/src/app/core/auth/auth.service.ts
client/src/app/core/confirm/confirm.service.ts
client/src/app/core/plugins/plugin.service.ts
client/src/app/core/rest/rest-extractor.service.ts
client/src/app/menu/notification.component.ts
client/src/app/modal/instance-config-warning-modal.component.ts
client/src/app/modal/quick-settings-modal.component.ts
client/src/app/modal/welcome-modal.component.ts
client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts
client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts
client/src/app/shared/shared-custom-markup/custom-markup.service.ts
client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts
client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts
client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
client/src/app/shared/shared-instance/instance-about-accordion.component.ts
client/src/app/shared/shared-main/auth/auth-interceptor.service.ts
client/src/app/shared/shared-main/users/user-notifications.component.ts
client/src/app/shared/shared-moderation/account-blocklist.component.ts
client/src/app/shared/shared-moderation/report-modals/account-report.component.ts
client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts
client/src/app/shared/shared-moderation/report-modals/video-report.component.ts
client/src/app/shared/shared-moderation/server-blocklist.component.ts
client/src/app/shared/shared-moderation/user-ban-modal.component.ts
client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts
client/src/app/shared/shared-moderation/video-block.component.ts
client/src/app/shared/shared-search/find-in-bulk.service.ts
client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
client/src/app/shared/shared-user-settings/user-video-settings.component.ts
client/src/app/shared/shared-user-subscription/subscribe-button.component.ts
client/src/app/shared/shared-video-miniature/abstract-video-list.ts
client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
client/src/app/shared/shared-video-miniature/video-download.component.ts
client/src/app/shared/shared-video-miniature/video-miniature.component.ts
client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts
client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts
client/src/root-helpers/plugins-manager.ts

index d335cbf45e43279f46131691e9fbef0ddea0d988..1dcb6396c7c2acd41a9a33c73229e703ecafec68 100644 (file)
@@ -91,8 +91,8 @@ export class AboutFollowsComponent implements OnInit {
     const pagination = this.restService.componentPaginationToRestPagination(this.followersPagination)
 
     this.followService.getFollowers({ pagination: pagination, sort: this.sort, state: 'accepted' })
-        .subscribe(
-          resultList => {
+        .subscribe({
+          next: resultList => {
             if (reset) this.followers = []
 
             const newFollowers = resultList.data.map(r => r.follower.host)
@@ -101,16 +101,16 @@ export class AboutFollowsComponent implements OnInit {
             this.followersPagination.totalItems = resultList.total
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   private loadMoreFollowings (reset = false) {
     const pagination = this.restService.componentPaginationToRestPagination(this.followingsPagination)
 
     this.followService.getFollowing({ pagination, sort: this.sort, state: 'accepted' })
-        .subscribe(
-          resultList => {
+        .subscribe({
+          next: resultList => {
             if (reset) this.followings = []
 
             const newFollowings = resultList.data.map(r => r.following.host)
@@ -119,8 +119,8 @@ export class AboutFollowsComponent implements OnInit {
             this.followingsPagination.totalItems = resultList.total
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
 }
index 37e9feacb0951896af18f884b2e690aeea92626d..cbc75988129b50fd1030339eecba8ef76da68583 100644 (file)
@@ -83,18 +83,18 @@ export class ContactAdminModalComponent extends FormReactive implements OnInit {
     const body = this.form.value[ 'body' ]
 
     this.instanceService.contactAdministrator(fromEmail, fromName, subject, body)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Your message has been sent.`)
             this.hide()
           },
 
-          err => {
+          error: err => {
             this.error = err.status === HttpStatusCode.FORBIDDEN_403
               ? $localize`You already sent this form recently`
               : err.message
           }
-        )
+        })
   }
 
   private prefillForm (prefill: Prefill) {
index 5b59f3cd0e556ea73d73a82a456238e999c7bfd9..25eb13588d8710d7f1fc1ecf74a3e316142aab5c 100644 (file)
@@ -71,11 +71,11 @@ export class AccountsComponent implements OnInit, OnDestroy {
                             HttpStatusCode.NOT_FOUND_404
                           ]))
                         )
-                        .subscribe(
-                          videoChannels => this.videoChannels = videoChannels.data,
+                        .subscribe({
+                          next: videoChannels => this.videoChannels = videoChannels.data,
 
-                          err => this.notifier.error(err.message)
-                        )
+                          error: err => this.notifier.error(err.message)
+                        })
 
     this.links = [
       { label: $localize`CHANNELS`, routerLink: 'video-channels' },
@@ -174,11 +174,12 @@ export class AccountsComponent implements OnInit, OnDestroy {
 
     const user = this.authService.getUser()
     if (user.hasRight(UserRight.MANAGE_USERS)) {
-      this.userService.getUser(account.userId).subscribe(
-        accountUser => this.accountUser = accountUser,
+      this.userService.getUser(account.userId)
+        .subscribe({
+          next: accountUser => this.accountUser = accountUser,
 
-        err => this.notifier.error(err.message)
-      )
+          error: err => this.notifier.error(err.message)
+        })
     }
   }
 
index 1e8cfb0217d191b980da6ffb64b5ab41ec47012d..538fa6f145d6405e1c2e955c17666b4e694ede13 100644 (file)
@@ -267,8 +267,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
       this.configService.updateCustomConfig(omit(value, 'instanceCustomHomepage')),
       this.customPage.updateInstanceHomepage(value.instanceCustomHomepage.content)
     ])
-      .subscribe(
-        ([ resConfig ]) => {
+      .subscribe({
+        next: ([ resConfig ]) => {
           const instanceCustomHomepage = {
             content: value.instanceCustomHomepage.content
           }
@@ -284,8 +284,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
           this.notifier.success($localize`Configuration updated.`)
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   hasConsistentOptions () {
@@ -339,8 +339,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
     forkJoin([
       this.configService.getCustomConfig(),
       this.customPage.getInstanceHomepage()
-    ])
-      .subscribe(([ config, homepage ]) => {
+    ]).subscribe({
+      next: ([ config, homepage ]) => {
         this.customConfig = { ...config, instanceCustomHomepage: homepage }
 
         this.updateForm()
@@ -348,21 +348,21 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
         this.forceCheck()
       },
 
-      err => this.notifier.error(err.message)
-    )
+      error: err => this.notifier.error(err.message)
+    })
   }
 
   private loadCategoriesAndLanguages () {
     forkJoin([
       this.serverService.getVideoLanguages(),
       this.serverService.getVideoCategories()
-    ]).subscribe(
-      ([ languages, categories ]) => {
+    ]).subscribe({
+      next: ([ languages, categories ]) => {
         this.languageItems = languages.map(l => ({ label: l.label, id: l.id }))
         this.categoryItems = categories.map(l => ({ label: l.label, id: l.id + '' }))
       },
 
-      err => this.notifier.error(err.message)
-    )
+      error: err => this.notifier.error(err.message)
+    })
   }
 }
index 4a312f6aa891bbdec94ed53bebc6236bf7871198..b867b4ba5cf9eddf950b4146e11ad3e371f71997 100644 (file)
@@ -35,17 +35,17 @@ export class FollowersListComponent extends RestTable implements OnInit {
     follow.state = 'accepted'
 
     this.followService.acceptFollower(follow)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           const handle = follow.follower.name + '@' + follow.follower.host
           this.notifier.success($localize`${handle} accepted in instance followers`)
         },
 
-        err => {
+        error: err => {
           follow.state = 'pending'
           this.notifier.error(err.message)
         }
-      )
+      })
   }
 
   async rejectFollower (follow: ActorFollow) {
@@ -54,19 +54,19 @@ export class FollowersListComponent extends RestTable implements OnInit {
     if (res === false) return
 
     this.followService.rejectFollower(follow)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             const handle = follow.follower.name + '@' + follow.follower.host
             this.notifier.success($localize`${handle} rejected from instance followers`)
 
             this.reloadData()
           },
 
-          err => {
+          error: err => {
             follow.state = 'pending'
             this.notifier.error(err.message)
           }
-        )
+        })
   }
 
   async deleteFollower (follow: ActorFollow) {
@@ -75,27 +75,27 @@ export class FollowersListComponent extends RestTable implements OnInit {
     if (res === false) return
 
     this.followService.removeFollower(follow)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             const handle = follow.follower.name + '@' + follow.follower.host
             this.notifier.success($localize`${handle} removed from instance followers`)
 
             this.reloadData()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   protected reloadData () {
     this.followService.getFollowers({ pagination: this.pagination, sort: this.sort, search: this.search })
-                      .subscribe(
-                        resultList => {
+                      .subscribe({
+                        next: resultList => {
                           this.followers = resultList.data
                           this.totalRecords = resultList.total
                         },
 
-                        err => this.notifier.error(err.message)
-                      )
+                        error: err => this.notifier.error(err.message)
+                      })
   }
 }
index dc69092002714072d7509ea38b64a94d9304f786..c55fc8d81f2380066dc88a8dbebf48e4e6cd8f1e 100644 (file)
@@ -57,13 +57,14 @@ export class FollowModalComponent extends FormReactive implements OnInit {
   private async addFollowing () {
     const hostsOrHandles = splitAndGetNotEmpty(this.form.value['hostsOrHandles'])
 
-    this.followService.follow(hostsOrHandles).subscribe(
-      () => {
-        this.notifier.success($localize`Follow request(s) sent!`)
-        this.newFollow.emit()
-      },
+    this.followService.follow(hostsOrHandles)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`Follow request(s) sent!`)
+          this.newFollow.emit()
+        },
 
-      err => this.notifier.error(err.message)
-    )
+        error: err => this.notifier.error(err.message)
+      })
   }
 }
index ba62dfa231a3d6a6fecfc027cf98e98d7c538b97..cf0225098cdcc0c9219b8e3d549865d25cc7904b 100644 (file)
@@ -49,25 +49,26 @@ export class FollowingListComponent extends RestTable implements OnInit {
     )
     if (res === false) return
 
-    this.followService.unfollow(follow).subscribe(
-      () => {
-        this.notifier.success($localize`You are not following ${follow.following.host} anymore.`)
-        this.reloadData()
-      },
+    this.followService.unfollow(follow)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`You are not following ${follow.following.host} anymore.`)
+          this.reloadData()
+        },
 
-      err => this.notifier.error(err.message)
-    )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   protected reloadData () {
     this.followService.getFollowing({ pagination: this.pagination, sort: this.sort, search: this.search })
-                      .subscribe(
-                        resultList => {
+                      .subscribe({
+                        next: resultList => {
                           this.following = resultList.data
                           this.totalRecords = resultList.total
                         },
 
-                        err => this.notifier.error(err.message)
-                      )
+                        error: err => this.notifier.error(err.message)
+                      })
   }
 }
index 729b7f5991350876e186bc0fd00efb6a93a592d3..47c402510e844ff56bb132b9a320b5a136eaa840 100644 (file)
@@ -18,14 +18,14 @@ export class RedundancyCheckboxComponent {
 
   updateRedundancyState () {
     this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             const stateLabel = this.redundancyAllowed ? $localize`enabled` : $localize`disabled`
 
             this.notifier.success($localize`Redundancy for ${this.host} is ${stateLabel}`)
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 }
index 3cd65dd6e3ed144798dd4c751ec5bc7f2d626d82..4c691269a1cfde957624fc50b6236706df58e86a 100644 (file)
@@ -142,14 +142,14 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
     if (res === false) return
 
     this.redundancyService.removeVideoRedundancies(redundancy)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.notifier.success($localize`Video redundancies removed!`)
           this.reloadData()
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
 
   }
 
@@ -161,14 +161,14 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
     }
 
     this.redundancyService.listVideoRedundancies(options)
-                      .subscribe(
-                        resultList => {
+                      .subscribe({
+                        next: resultList => {
                           this.videoRedundancies = resultList.data
                           this.totalRecords = resultList.total
                         },
 
-                        err => this.notifier.error(err.message)
-                      )
+                        error: err => this.notifier.error(err.message)
+                      })
   }
 
   private loadSelectLocalStorage () {
index 4fe5ec441d0770c2098de60c5b4a8b3af5a1712d..adef16975bdad4b40781fc93737a5091eb71875e 100644 (file)
@@ -62,14 +62,14 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
           handler: videoBlock => {
             this.videoBlocklistService.unblockVideo(videoBlock.video.id).pipe(
               switchMap(_ => this.videoBlocklistService.blockVideo(videoBlock.video.id, undefined, true))
-            ).subscribe(
-              () => {
+            ).subscribe({
+              next: () => {
                 this.notifier.success($localize`Video ${videoBlock.video.name} switched to manual block.`)
                 this.reloadData()
               },
 
-              err => this.notifier.error(err.message)
-            )
+              error: err => this.notifier.error(err.message)
+            })
           },
           isDisplayed: videoBlock => videoBlock.type === VideoBlacklistType.AUTO_BEFORE_PUBLISHED
         }
@@ -94,13 +94,11 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
             if (res === false) return
 
             this.videoService.removeVideo(videoBlock.video.id)
-              .subscribe(
-                () => {
-                  this.notifier.success($localize`Video deleted.`)
-                },
+              .subscribe({
+                next: () => this.notifier.success($localize`Video deleted.`),
 
-                err => this.notifier.error(err.message)
-              )
+                error: err => this.notifier.error(err.message)
+              })
           }
         }
       ]
@@ -136,14 +134,15 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
     const res = await this.confirmService.confirm(confirmMessage, $localize`Unblock`)
     if (res === false) return
 
-    this.videoBlocklistService.unblockVideo(entry.video.id).subscribe(
-      () => {
-        this.notifier.success($localize`Video ${entry.video.name} unblocked.`)
-        this.reloadData()
-      },
+    this.videoBlocklistService.unblockVideo(entry.video.id)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`Video ${entry.video.name} unblocked.`)
+          this.reloadData()
+        },
 
-      err => this.notifier.error(err.message)
-    )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   getVideoEmbed (entry: VideoBlacklist) {
@@ -164,8 +163,8 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
       sort: this.sort,
       search: this.search
     })
-      .subscribe(
-        async resultList => {
+      .subscribe({
+        next: async resultList => {
           this.totalRecords = resultList.total
 
           this.blocklist = resultList.data
@@ -178,7 +177,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
           }
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 }
index 9d9283536dccdfdc5c94191c674dd0abca8371d9..0fd0588bac6db017b139cf6de1c8c90d5873478e 100644 (file)
 
   <ng-template pTemplate="header">
     <tr>
-      <th style="width: 40px">
+      <th style="width: 40px;">
         <p-tableHeaderCheckbox ariaLabel="Select all rows" i18n-ariaLabel></p-tableHeaderCheckbox>
       </th>
-      <th style="width: 40px"></th>
+      <th style="width: 40px;"></th>
       <th style="width: 150px;"></th>
-      <th style="width: 300px" i18n>Account</th>
-      <th style="width: 300px" i18n>Video</th>
+      <th style="width: 300px;" i18n>Account</th>
+      <th style="width: 300px;" i18n>Video</th>
       <th i18n>Comment</th>
       <th style="width: 150px;" i18n pSortableColumn="createdAt">Date <p-sortIcon field="createdAt"></p-sortIcon></th>
     </tr>
index e2ae993b0598fa02e8c7a804acf811b5a9d8a0d4..4904bcc25aaf8247f2d6002bcdae7086606a2322 100644 (file)
@@ -1,5 +1,5 @@
 import { SortMeta } from 'primeng/api'
-import { AfterViewInit, Component, OnInit } from '@angular/core'
+import { Component, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
 import { AuthService, ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core'
 import { AdvancedInputFilter } from '@app/shared/shared-forms'
@@ -117,45 +117,46 @@ export class VideoCommentListComponent extends RestTable implements OnInit {
       pagination: this.pagination,
       sort: this.sort,
       search: this.search
-    }).subscribe(
-        async resultList => {
-          this.totalRecords = resultList.total
+    }).subscribe({
+      next: async resultList => {
+        this.totalRecords = resultList.total
 
-          this.comments = []
+        this.comments = []
 
-          for (const c of resultList.data) {
-            this.comments.push(
-              new VideoCommentAdmin(c, await this.toHtml(c.text))
-            )
-          }
-        },
+        for (const c of resultList.data) {
+          this.comments.push(
+            new VideoCommentAdmin(c, await this.toHtml(c.text))
+          )
+        }
+      },
 
-        err => this.notifier.error(err.message)
-      )
+      error: err => this.notifier.error(err.message)
+    })
   }
 
   private async removeComments (comments: VideoCommentAdmin[]) {
     const commentArgs = comments.map(c => ({ videoId: c.video.id, commentId: c.id }))
 
-    this.videoCommentService.deleteVideoComments(commentArgs).subscribe(
-      () => {
-        this.notifier.success($localize`${commentArgs.length} comments deleted.`)
-        this.reloadData()
-      },
+    this.videoCommentService.deleteVideoComments(commentArgs)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`${commentArgs.length} comments deleted.`)
+          this.reloadData()
+        },
 
-      err => this.notifier.error(err.message),
+        error: err => this.notifier.error(err.message),
 
-      () => this.selectedComments = []
-    )
+        complete: () => this.selectedComments = []
+      })
   }
 
   private deleteComment (comment: VideoCommentAdmin) {
     this.videoCommentService.deleteVideoComment(comment.video.id, comment.id)
-      .subscribe(
-        () => this.reloadData(),
+      .subscribe({
+        next: () => this.reloadData(),
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   private async deleteUserComments (comment: VideoCommentAdmin) {
@@ -169,12 +170,12 @@ export class VideoCommentListComponent extends RestTable implements OnInit {
     }
 
     this.bulkService.removeCommentsOf(options)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.notifier.success($localize`Comments of ${options.accountName} will be deleted in a few minutes`)
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 }
index 968abcbe5854c1d1119c37268789f32eb4675425..85f9879bf941ec8b152070e4fe79a43687f1a31d 100644 (file)
@@ -61,16 +61,16 @@ export class PluginListInstalledComponent implements OnInit {
 
   loadMorePlugins () {
     this.pluginApiService.getPlugins(this.pluginType, this.pagination, this.sort)
-        .subscribe(
-          res => {
+        .subscribe({
+          next: res => {
             this.plugins = this.plugins.concat(res.data)
             this.pagination.totalItems = res.total
 
             this.onDataSubject.next(res.data)
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   onNearOfBottom () {
@@ -113,16 +113,16 @@ export class PluginListInstalledComponent implements OnInit {
     if (res === false) return
 
     this.pluginApiService.uninstall(plugin.name, plugin.type)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.notifier.success($localize`${plugin.name} uninstalled.`)
 
           this.plugins = this.plugins.filter(p => p.name !== plugin.name)
           this.pagination.totalItems--
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   async update (plugin: PeerTubePlugin) {
@@ -143,8 +143,8 @@ export class PluginListInstalledComponent implements OnInit {
 
     this.pluginApiService.update(plugin.name, plugin.type)
         .pipe()
-        .subscribe(
-          res => {
+        .subscribe({
+          next: res => {
             this.updating[updatingKey] = false
 
             this.notifier.success($localize`${plugin.name} updated.`)
@@ -152,8 +152,8 @@ export class PluginListInstalledComponent implements OnInit {
             Object.assign(plugin, res)
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   getShowRouterLink (plugin: PeerTubePlugin) {
index 0a6e57904a82e2cddcef4436ffdfe4a42dace750..803777eb30a49c4114d75d99dc644469cd2a5875 100644 (file)
@@ -84,8 +84,8 @@ export class PluginSearchComponent implements OnInit {
     this.isSearching = true
 
     this.pluginApiService.searchAvailablePlugins(this.pluginType, this.pagination, this.sort, this.search)
-        .subscribe(
-          res => {
+        .subscribe({
+          next: res => {
             this.isSearching = false
 
             this.plugins = this.plugins.concat(res.data)
@@ -94,13 +94,13 @@ export class PluginSearchComponent implements OnInit {
             this.onDataSubject.next(res.data)
           },
 
-          err => {
+          error: err => {
             console.error(err)
 
             const message = $localize`The plugin index is not available. Please retry later.`
             this.notifier.error(message)
           }
-        )
+        })
   }
 
   onNearOfBottom () {
@@ -139,8 +139,8 @@ export class PluginSearchComponent implements OnInit {
     this.installing[plugin.npmName] = true
 
     this.pluginApiService.install(plugin.npmName)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.installing[plugin.npmName] = false
             this.pluginInstalled = true
 
@@ -149,7 +149,7 @@ export class PluginSearchComponent implements OnInit {
             plugin.installed = true
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 }
index c3d14d2b37a05723e1e27d207a3072d0fb308286..10fb5291157249c08dabb144fc4b1afa2403eb21 100644 (file)
@@ -50,13 +50,13 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
     const settings = this.form.value
 
     this.pluginAPIService.updatePluginSettings(this.plugin.name, this.plugin.type, settings)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Settings updated.`)
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   hasRegisteredSettings () {
@@ -83,8 +83,8 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
           return this.pluginAPIService.getPluginRegisteredSettings(plugin.name, plugin.type)
             .pipe(map(data => ({ plugin, registeredSettings: data.registeredSettings })))
         }))
-        .subscribe(
-          async ({ plugin, registeredSettings }) => {
+        .subscribe({
+          next: async ({ plugin, registeredSettings }) => {
             this.plugin = plugin
 
             this.registeredSettings = await this.translateSettings(registeredSettings)
@@ -94,8 +94,8 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
             this.buildSettingsForm()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   private buildSettingsForm () {
index a88d837f31fa934e997794fe68fd92f154a4bbd5..1f4e71e8ac59a2c97385ce28c9d4b55598eec4ed 100644 (file)
@@ -22,10 +22,10 @@ export class DebugComponent implements OnInit {
 
   load () {
     this.debugService.getDebug()
-        .subscribe(
-          debug => this.debug = debug,
+        .subscribe({
+          next: debug => this.debug = debug,
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 }
index 4b02e1bc12154f6c0bc5fb62a33d7af854a536b6..b12d7f80a5e7d29e723fdf4cc152ed9c8e0b1739 100644 (file)
@@ -119,14 +119,14 @@ export class JobsComponent extends RestTable implements OnInit {
         pagination: this.pagination,
         sort: this.sort
       })
-      .subscribe(
-        resultList => {
+      .subscribe({
+        next: resultList => {
           this.jobs = resultList.data
           this.totalRecords = resultList.total
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   private loadJobStateAndType () {
index 48318f07baaa55b827e9df2ee4f243d5f1590ed4..865ab80a203b4a5842c07a1aa0b60c88847d21db 100644 (file)
@@ -52,8 +52,8 @@ export class LogsComponent implements OnInit {
     this.loading = true
 
     this.logsService.getLogs({ isAuditLog: this.isAuditLog(), level: this.level, startDate: this.startDate })
-        .subscribe(
-          logs => {
+        .subscribe({
+          next: logs => {
             this.logs = logs
 
             setTimeout(() => {
@@ -61,10 +61,10 @@ export class LogsComponent implements OnInit {
             })
           },
 
-          err => this.notifier.error(err.message),
+          error: err => this.notifier.error(err.message),
 
-          () => this.loading = false
-        )
+          complete: () => this.loading = false
+        })
   }
 
   isAuditLog () {
index c26ad1208268555486ae90c459c892a96fc96290..8403db91a8b444b563550d57b19d0defab759be9 100644 (file)
@@ -71,14 +71,15 @@ export class UserCreateComponent extends UserEdit implements OnInit {
     userCreate.videoQuota = parseInt(this.form.value['videoQuota'], 10)
     userCreate.videoQuotaDaily = parseInt(this.form.value['videoQuotaDaily'], 10)
 
-    this.userService.addUser(userCreate).subscribe(
-      () => {
-        this.notifier.success($localize`User ${userCreate.username} created.`)
-        this.router.navigate([ '/admin/users/list' ])
-      },
+    this.userService.addUser(userCreate)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`User ${userCreate.username} created.`)
+          this.router.navigate([ '/admin/users/list' ])
+        },
 
-      err => this.error = err.message
-    )
+        error: err => this.error = err.message
+      })
   }
 
   isCreation () {
index 05d52b17f0679db2853deda66db76122d7a7c09a..7c42b92414139d2ba0446cf3dcdbfde1779bc676 100644 (file)
@@ -35,13 +35,12 @@ export class UserPasswordComponent extends FormReactive implements OnInit {
 
     const userUpdate: UserUpdate = this.form.value
 
-    this.userService.updateUser(this.userId, userUpdate).subscribe(
-      () => {
-        this.notifier.success($localize`Password changed for user ${this.username}.`)
-      },
+    this.userService.updateUser(this.userId, userUpdate)
+      .subscribe({
+        next: () => this.notifier.success($localize`Password changed for user ${this.username}.`),
 
-      err => this.error = err.message
-    )
+        error: err => this.error = err.message
+      })
   }
 
   togglePasswordVisibility () {
index 1527508f7a119e8c3d508ef52a874ac184ee441a..2128ba4fdd70b031673443a5972feeb986a4fd7b 100644 (file)
@@ -59,11 +59,12 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
 
     this.paramsSub = this.route.params.subscribe(routeParams => {
       const userId = routeParams['id']
-      this.userService.getUser(userId, true).subscribe(
-        user => this.onUserFetched(user),
+      this.userService.getUser(userId, true)
+        .subscribe({
+          next: user => this.onUserFetched(user),
 
-        err => this.error = err.message
-      )
+          error: err => this.error = err.message
+        })
     })
   }
 
@@ -83,14 +84,15 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
 
     if (userUpdate.pluginAuth === 'null') userUpdate.pluginAuth = null
 
-    this.userService.updateUser(this.user.id, userUpdate).subscribe(
-      () => {
-        this.notifier.success($localize`User ${this.user.username} updated.`)
-        this.router.navigate([ '/admin/users/list' ])
-      },
+    this.userService.updateUser(this.user.id, userUpdate)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`User ${this.user.username} updated.`)
+          this.router.navigate([ '/admin/users/list' ])
+        },
 
-      err => this.error = err.message
-    )
+        error: err => this.error = err.message
+      })
   }
 
   isCreation () {
@@ -106,13 +108,14 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
   }
 
   resetPassword () {
-    this.userService.askResetPassword(this.user.email).subscribe(
-      () => {
-        this.notifier.success($localize`An email asking for password reset has been sent to ${this.user.username}.`)
-      },
-
-      err => this.error = err.message
-    )
+    this.userService.askResetPassword(this.user.email)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`An email asking for password reset has been sent to ${this.user.username}.`)
+        },
+
+        error: err => this.error = err.message
+      })
   }
 
   private onUserFetched (userJson: UserType) {
index e3ae68a93bd26b2fa8b7a89de112c22a8650fbea..d4406549a15b8d729cc7e51bce3a7d02c0a64b21 100644 (file)
@@ -173,14 +173,14 @@ export class UserListComponent extends RestTable implements OnInit {
     if (res === false) return
 
     this.userService.unbanUsers(users)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`${users.length} users unbanned.`)
             this.reloadData()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   async removeUsers (users: User[]) {
@@ -195,25 +195,27 @@ export class UserListComponent extends RestTable implements OnInit {
     const res = await this.confirmService.confirm(message, $localize`Delete`)
     if (res === false) return
 
-    this.userService.removeUser(users).subscribe(
-      () => {
-        this.notifier.success($localize`${users.length} users deleted.`)
-        this.reloadData()
-      },
+    this.userService.removeUser(users)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`${users.length} users deleted.`)
+          this.reloadData()
+        },
 
-      err => this.notifier.error(err.message)
-    )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   async setEmailsAsVerified (users: User[]) {
-    this.userService.updateUsers(users, { emailVerified: true }).subscribe(
-      () => {
-        this.notifier.success($localize`${users.length} users email set as verified.`)
-        this.reloadData()
-      },
+    this.userService.updateUsers(users, { emailVerified: true })
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`${users.length} users email set as verified.`)
+          this.reloadData()
+        },
 
-      err => this.notifier.error(err.message)
-    )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   isInSelectionMode () {
@@ -227,13 +229,13 @@ export class UserListComponent extends RestTable implements OnInit {
       pagination: this.pagination,
       sort: this.sort,
       search: this.search
-    }).subscribe(
-      resultList => {
+    }).subscribe({
+      next: resultList => {
         this.users = resultList.data
         this.totalRecords = resultList.total
       },
 
-      err => this.notifier.error(err.message)
-    )
+      error: err => this.notifier.error(err.message)
+    })
   }
 }
index 9731383afc78cb1a1b0c61e78689389368d49bfa..16876afd6d930748819cc522d4085b4b71ba5f57 100644 (file)
@@ -107,17 +107,17 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
     const { username, password } = this.form.value
 
     this.authService.login(username, password)
-      .subscribe(
-        () => this.redirectService.redirectToPreviousRoute(),
+      .subscribe({
+        next: () => this.redirectService.redirectToPreviousRoute(),
 
-        err => this.handleError(err)
-      )
+        error: err => this.handleError(err)
+      })
   }
 
   askResetPassword () {
     this.userService.askResetPassword(this.forgotPasswordEmail)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           const message = $localize`An email with the reset password instructions will be sent to ${this.forgotPasswordEmail}.
 The link will expire within 1 hour.`
 
@@ -125,8 +125,8 @@ The link will expire within 1 hour.`
           this.hideForgotPasswordModal()
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   openForgotPasswordModal () {
@@ -149,14 +149,14 @@ The link will expire within 1 hour.`
     this.isAuthenticatedWithExternalAuth = true
 
     this.authService.login(username, null, token)
-    .subscribe(
-      () => this.redirectService.redirectToPreviousRoute(),
-
-      err => {
-        this.handleError(err)
-        this.isAuthenticatedWithExternalAuth = false
-      }
-    )
+      .subscribe({
+        next: () => this.redirectService.redirectToPreviousRoute(),
+
+        error: err => {
+          this.handleError(err)
+          this.isAuthenticatedWithExternalAuth = false
+        }
+      })
   }
 
   private handleError (err: any) {
index 5e9525fbbd8a2b954cc079856227a61dbb7ce953..6873c7d40139f0396481e4c81fa6b008a41a871e 100644 (file)
@@ -1,5 +1,5 @@
 import { Component, OnInit } from '@angular/core'
-import { AuthService, Notifier, ConfirmService, ScopedTokensService } from '@app/core'
+import { AuthService, ConfirmService, Notifier, ScopedTokensService } from '@app/core'
 import { VideoService } from '@app/shared/shared-main'
 import { FeedFormat } from '@shared/models'
 import { ScopedToken } from '@shared/models/users/user-scoped-token'
@@ -27,13 +27,11 @@ export class MyAccountApplicationsComponent implements OnInit {
   ngOnInit () {
     this.feedUrl = this.baseURL
     this.scopedTokensService.getScopedTokens()
-      .subscribe(
-        tokens => this.regenApplications(tokens),
+      .subscribe({
+        next: tokens => this.regenApplications(tokens),
 
-        err => {
-          this.notifier.error(err.message)
-        }
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   async renewToken () {
@@ -43,17 +41,15 @@ export class MyAccountApplicationsComponent implements OnInit {
     )
     if (res === false) return
 
-    this.scopedTokensService.renewScopedTokens().subscribe(
-      tokens => {
-        this.regenApplications(tokens)
-        this.notifier.success($localize`Token renewed. Update your client configuration accordingly.`)
-      },
-
-      err => {
-        this.notifier.error(err.message)
-      }
-    )
+    this.scopedTokensService.renewScopedTokens()
+      .subscribe({
+        next: tokens => {
+          this.regenApplications(tokens)
+          this.notifier.success($localize`Token renewed. Update your client configuration accordingly.`)
+        },
 
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   private regenApplications (tokens: ScopedToken) {
index b2b7849c24052d406c3d9baac2bfcb40242b2b81..08bc5b425480fae705163cf693da15c44f89ecb8 100644 (file)
@@ -45,8 +45,8 @@ export class MyAccountChangeEmailComponent extends FormReactive implements OnIni
       this.serverService.getConfig(),
       this.userService.changeEmail(password, email)
     ]).pipe(tap(() => this.authService.refreshUserInformation()))
-      .subscribe(
-        ([ config ]) => {
+      .subscribe({
+        next: ([ config ]) => {
           this.form.reset()
 
           if (config.signup.requiresEmailVerification) {
@@ -56,7 +56,7 @@ export class MyAccountChangeEmailComponent extends FormReactive implements OnIni
           }
         },
 
-        err => {
+        error: err => {
           if (err.status === 401) {
             this.error = $localize`You current password is invalid.`
             return
@@ -64,6 +64,6 @@ export class MyAccountChangeEmailComponent extends FormReactive implements OnIni
 
           this.error = err.message
         }
-      )
+      })
   }
 }
index e034aedef9495db54b944d497ad44f53e80a144d..f91b2f37b18d6889d973765a9a5a8dc4d496874f 100644 (file)
@@ -43,22 +43,23 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On
     const currentPassword = this.form.value[ 'current-password' ]
     const newPassword = this.form.value[ 'new-password' ]
 
-    this.userService.changePassword(currentPassword, newPassword).subscribe(
-      () => {
-        this.notifier.success($localize`Password updated.`)
+    this.userService.changePassword(currentPassword, newPassword)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`Password updated.`)
 
-        this.form.reset()
-        this.error = null
-      },
+          this.form.reset()
+          this.error = null
+        },
 
-      err => {
-        if (err.status === 401) {
-          this.error = $localize`You current password is invalid.`
-          return
-        }
+        error: err => {
+          if (err.status === 401) {
+            this.error = $localize`You current password is invalid.`
+            return
+          }
 
-        this.error = err.message
-      }
-    )
+          this.error = err.message
+        }
+      })
   }
 }
index 387e9e7cd6aa251025416461982792402808ddfd..5005cb630426ada7c21ef830e0ee9707150f659e 100644 (file)
@@ -27,15 +27,16 @@ export class MyAccountDangerZoneComponent {
     )
     if (res === false) return
 
-    this.userService.deleteMe().subscribe(
-      () => {
-        this.notifier.success($localize`Your account is deleted.`)
+    this.userService.deleteMe()
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`Your account is deleted.`)
 
-        this.authService.logout()
-        this.redirectService.redirectToHomepage()
-      },
+          this.authService.logout()
+          this.redirectService.redirectToHomepage()
+        },
 
-      err => this.notifier.error(err.message)
-    )
+        error: err => this.notifier.error(err.message)
+      })
   }
 }
index b94e6ad824d77ec37b05ca2c67646816fdf2907c..1eac06234e17d1c9ea27bff8e77175b819079499 100644 (file)
@@ -89,13 +89,13 @@ export class MyAccountNotificationPreferencesComponent implements OnInit {
 
   private savePreferencesImpl () {
     this.userNotificationService.updateNotificationSettings(this.user.notificationSettings)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.notifier.success($localize`Preferences saved`, undefined, 2000)
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   private loadNotificationSettings () {
index 80e4446c883b78b101e9bde157d172abdef58814..f395ad73f67afd0a9b0cef0bbd8ce30d6ca855d9 100644 (file)
@@ -50,15 +50,16 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit {
 
     this.error = null
 
-    this.userService.updateMyProfile({ displayName, description }).subscribe(
-      () => {
+    this.userService.updateMyProfile({ displayName, description })
+    .subscribe({
+      next: () => {
         this.user.account.displayName = displayName
         this.user.account.description = description
 
         this.notifier.success($localize`Profile updated.`)
       },
 
-      err => this.error = err.message
-    )
+      error: err => this.error = err.message
+    })
   }
 }
index a0f2f28f89d1e4ab22e365354e64f5d6fccdd7b3..fc7635f38736cce6afab9533fbed967f4705bb58 100644 (file)
@@ -39,31 +39,31 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {
 
   onAvatarChange (formData: FormData) {
     this.userService.changeAvatar(formData)
-      .subscribe(
-        data => {
+      .subscribe({
+        next: data => {
           this.notifier.success($localize`Avatar changed.`)
 
           this.user.updateAccountAvatar(data.avatar)
         },
 
-        (err: HttpErrorResponse) => genericUploadErrorHandler({
+        error: (err: HttpErrorResponse) => genericUploadErrorHandler({
           err,
           name: $localize`avatar`,
           notifier: this.notifier
         })
-      )
+      })
   }
 
   onAvatarDelete () {
     this.userService.deleteAvatar()
-      .subscribe(
-        data => {
+      .subscribe({
+        next: data => {
           this.notifier.success($localize`Avatar deleted.`)
 
           this.user.updateAccountAvatar()
         },
 
-        (err: HttpErrorResponse) => this.notifier.error(err.message)
-      )
+        error: (err: HttpErrorResponse) => this.notifier.error(err.message)
+      })
   }
 }
index 433475f666053946d2304b3210742716a299a340..d983aacd919fddb4e216c38300eabb364169423f 100644 (file)
@@ -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) {
index eb24a60c5a8bd268890c8d86f53a267658af4aed..e8bfbf9ce7e7bb4fecd7e06f857fd9379f95177f 100644 (file)
@@ -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 () {
index b6a2f592dcd954468b429a0a0e2d3c42e130a4be..8b665fd5803da719505261b3ff792bf10c51413f 100644 (file)
@@ -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 () {
index ad83db7abc41bfbd6e267b0f10f5615fdcee9636..fe6e863467c9b852631ed437bb4c741f2b7c8de8 100644 (file)
@@ -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)
+        })
   }
 }
index 7889d0985177eaa60076894a788f06bd30c83c9f..b92377bca39bfab07255a78e6e4f411bdfff4338 100644 (file)
@@ -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)
+      })
   }
 }
index aaf028474c586f617670c037b0c14d2d7c5e2fbd..7ea940ceba219507c4dbafa586f476a3a186e476 100644 (file)
@@ -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)
+      })
   }
 }
index 1f4a931a01a1a6a6745fbccb193ffea121375dc4..f676aa014ddbb9791146a78f19ec76a188b9db76 100644 (file)
@@ -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)
+        })
   }
 }
index 68254526a377c364b2b2301d47852996ac06ca92..914785bf7448b4fa8ebf297e0e9afdc9f67285ef 100644 (file)
@@ -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)
+        })
   }
 }
index 8606a875a4d5f43d4f21f25b6c66f446289e0bed..3e3c3c8785306f4605587c7dbc815f2acdae609d 100644 (file)
@@ -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 () {
index 86fe707107d5a10c65dc4b57a7d409a9542a9238..6aff5dbd71bf7d5a07212d1f3e5c8885f96de399 100644 (file)
@@ -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)
+      })
   }
 
   /**
index c554d37724a0b63a991dce0cc5b6377506560351..a3f54279b8f2ab08ef9e549068d7afd5fff31ac0 100644 (file)
@@ -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 () {
index d90102693acab006a4dd542ef65a6124e1a45f14..f0e4c348ba0f72cf3a59cf4ce698786732bf2205 100644 (file)
@@ -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) {
index 84237dee1761a14d740cb3fd4f4bd88531635736..8c1f94bf3634d991ebaa3b2427ed82966f35f370 100644 (file)
@@ -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)
+      })
   }
 }
index 1e4a4406d6369d0538cdd0cc022264b8321990a3..4f9b71cc6052c2fa36b53627aa97af6f09319b5d 100644 (file)
@@ -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) {
index ce9144170b7ba64d34b83447c0c35358dfe02452..a1c04147bead55069493f78d98289485264d4a74 100644 (file)
@@ -42,14 +42,14 @@ export class ResetPasswordComponent extends FormReactive implements OnInit {
 
   resetPassword () {
     this.userService.resetPassword(this.userId, this.verificationString, this.form.value.password)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.notifier.success($localize`Your password has been successfully reset!`)
           this.router.navigate([ '/login' ])
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   isConfirmedPasswordValid () {
index 7425b70166a0d3a1b194a4accbce1e4de8981018..81d1006f8ea0840788cbe167e8f05728182ca9dc 100644 (file)
@@ -73,36 +73,37 @@ export class SearchComponent implements OnInit, OnDestroy {
   ngOnInit () {
     this.serverConfig = this.serverService.getHTMLConfig()
 
-    this.subActivatedRoute = this.route.queryParams.subscribe(
-      async queryParams => {
-        const querySearch = queryParams['search']
-        const searchTarget = queryParams['searchTarget']
-
-        // Search updated, reset filters
-        if (this.currentSearch !== querySearch || searchTarget !== this.advancedSearch.searchTarget) {
-          this.resetPagination()
-          this.advancedSearch.reset()
-
-          this.currentSearch = querySearch || undefined
-          this.updateTitle()
-        }
+    this.subActivatedRoute = this.route.queryParams
+      .subscribe({
+        next: async queryParams => {
+          const querySearch = queryParams['search']
+          const searchTarget = queryParams['searchTarget']
 
-        this.advancedSearch = new AdvancedSearch(queryParams)
-        if (!this.advancedSearch.searchTarget) {
-          this.advancedSearch.searchTarget = this.getDefaultSearchTarget()
-        }
+          // Search updated, reset filters
+          if (this.currentSearch !== querySearch || searchTarget !== this.advancedSearch.searchTarget) {
+            this.resetPagination()
+            this.advancedSearch.reset()
 
-        this.error = this.checkFieldsAndGetError()
+            this.currentSearch = querySearch || undefined
+            this.updateTitle()
+          }
 
-        // Don't hide filters if we have some of them AND the user just came on the webpage, or we have an error
-        this.isSearchFilterCollapsed = !this.error && (this.isInitialLoad === false || !this.advancedSearch.containsValues())
-        this.isInitialLoad = false
+          this.advancedSearch = new AdvancedSearch(queryParams)
+          if (!this.advancedSearch.searchTarget) {
+            this.advancedSearch.searchTarget = this.getDefaultSearchTarget()
+          }
 
-        this.search()
-      },
+          this.error = this.checkFieldsAndGetError()
 
-      err => this.notifier.error(err.text)
-    )
+          // Don't hide filters if we have some of them AND the user just came on the webpage, or we have an error
+          this.isSearchFilterCollapsed = !this.error && (this.isInitialLoad === false || !this.advancedSearch.containsValues())
+          this.isInitialLoad = false
+
+          this.search()
+        },
+
+        error: err => this.notifier.error(err.text)
+      })
 
     this.userService.getAnonymousOrLoggedUser()
       .subscribe(user => this.userMiniature = user)
@@ -140,33 +141,35 @@ export class SearchComponent implements OnInit, OnDestroy {
       this.getVideoChannelObs(),
       this.getVideoPlaylistObs(),
       this.getVideosObs()
-    ]).subscribe(results => {
-      for (const result of results) {
-        this.results = this.results.concat(result.data)
-      }
+    ]).subscribe({
+      next: results => {
+        for (const result of results) {
+          this.results = this.results.concat(result.data)
+        }
 
-      this.pagination.totalItems = results.reduce((p, r) => p += r.total, 0)
-      this.lastSearchTarget = this.advancedSearch.searchTarget
+        this.pagination.totalItems = results.reduce((p, r) => p += r.total, 0)
+        this.lastSearchTarget = this.advancedSearch.searchTarget
 
-      this.hasMoreResults = this.results.length < this.pagination.totalItems
-    },
+        this.hasMoreResults = this.results.length < this.pagination.totalItems
+      },
 
-    err => {
-      if (this.advancedSearch.searchTarget !== 'search-index') {
-        this.notifier.error(err.message)
-        return
-      }
+      error: err => {
+        if (this.advancedSearch.searchTarget !== 'search-index') {
+          this.notifier.error(err.message)
+          return
+        }
 
-      this.notifier.error(
-        $localize`Search index is unavailable. Retrying with instance results instead.`,
-        $localize`Search error`
-      )
-      this.advancedSearch.searchTarget = 'local'
-      this.search()
-    },
+        this.notifier.error(
+          $localize`Search index is unavailable. Retrying with instance results instead.`,
+          $localize`Search error`
+        )
+        this.advancedSearch.searchTarget = 'local'
+        this.search()
+      },
 
-    () => {
-      this.isSearching = false
+      complete: () => {
+        this.isSearching = false
+      }
     })
   }
 
index 241ca04c6a512549adb0923c203a510f427870a7..056442107c8a706dea3cc979263259f68cf6f1da 100644 (file)
@@ -122,8 +122,8 @@ export class RegisterComponent implements OnInit {
       'filter:api.signup.registration.create.params'
     )
 
-    this.userService.signup(body).subscribe(
-      () => {
+    this.userService.signup(body).subscribe({
+      next: () => {
         this.signupDone = true
 
         if (this.requiresEmailVerification) {
@@ -133,16 +133,16 @@ export class RegisterComponent implements OnInit {
 
         // Auto login
         this.authService.login(body.username, body.password)
-            .subscribe(
-              () => {
-                this.success = $localize`You are now logged in as ${body.username}!`
-              },
+          .subscribe({
+            next: () => {
+              this.success = $localize`You are now logged in as ${body.username}!`
+            },
 
-              err => this.error = err.message
-            )
+            error: err => this.error = err.message
+          })
       },
 
-      err => this.error = err.message
-    )
+      error: err => this.error = err.message
+    })
   }
 }
index afb0e6d6c58087f5f8e19d9a2d6c0b896f3a9f43..83c24a2513b7bd1eb94e67377ab4b79177ed8f09 100644 (file)
@@ -34,15 +34,13 @@ export class VerifyAccountAskSendEmailComponent extends FormReactive implements
   askSendVerifyEmail () {
     const email = this.form.value['verify-email-email']
     this.userService.askSendVerifyEmail(email)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.notifier.success($localize`An email with verification link will be sent to ${email}.`)
           this.redirectService.redirectToHomepage()
         },
 
-        err => {
-          this.notifier.error(err.message)
-        }
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 }
index acc688ab3f34ae7a3ef48b870ae74b2c6a2a4841..457a0abe0e7db882b1300e6e5944c59bd7f8f0f8 100644 (file)
@@ -38,8 +38,8 @@ export class VerifyAccountEmailComponent implements OnInit {
 
   verifyEmail () {
     this.userService.verifyEmail(this.userId, this.verificationString, this.isPendingEmail)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           if (this.authService.isLoggedIn()) {
             this.authService.refreshUserInformation()
           }
@@ -47,11 +47,11 @@ export class VerifyAccountEmailComponent implements OnInit {
           this.success = true
         },
 
-        err => {
+        error: err => {
           this.failed = true
 
           this.notifier.error(err.message)
         }
-      )
+      })
   }
 }
index db25dc6be44e8c10e08313bd9589e3ddccbe2bf0..30c79594dd1800c40003e36825d02691afbb0250 100644 (file)
@@ -8,7 +8,7 @@ import { FormValidatorService } from '@app/shared/shared-forms'
 import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
 import { LiveVideoService } from '@app/shared/shared-video-live'
 import { LoadingBarService } from '@ngx-loading-bar/core'
-import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode, VideoPrivacy } from '@shared/models'
+import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
 import { VideoSend } from './video-send'
 
 @Component({
@@ -74,33 +74,34 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
     const toPatch = Object.assign({}, video, { privacy: this.firstStepPrivacyId })
     this.form.patchValue(toPatch)
 
-    this.liveVideoService.goLive(video).subscribe(
-      res => {
-        this.videoId = res.video.id
-        this.videoUUID = res.video.uuid
-        this.isInUpdateForm = true
+    this.liveVideoService.goLive(video)
+      .subscribe({
+        next: res => {
+          this.videoId = res.video.id
+          this.videoUUID = res.video.uuid
+          this.isInUpdateForm = true
 
-        this.firstStepDone.emit(name)
+          this.firstStepDone.emit(name)
 
-        this.fetchVideoLive()
-      },
+          this.fetchVideoLive()
+        },
+
+        error: err => {
+          this.firstStepError.emit()
 
-      err => {
-        this.firstStepError.emit()
+          let message = err.message
 
-        let message = err.message
+          const error = err.body as PeerTubeProblemDocument
 
-        const error = err.body as PeerTubeProblemDocument
+          if (error?.code === ServerErrorCode.MAX_INSTANCE_LIVES_LIMIT_REACHED) {
+            message = $localize`Cannot create live because this instance have too many created lives`
+          } else if (error?.code === ServerErrorCode.MAX_USER_LIVES_LIMIT_REACHED) {
+            message = $localize`Cannot create live because you created too many lives`
+          }
 
-        if (error?.code === ServerErrorCode.MAX_INSTANCE_LIVES_LIMIT_REACHED) {
-          message = $localize`Cannot create live because this instance have too many created lives`
-        } else if (error?.code === ServerErrorCode.MAX_USER_LIVES_LIMIT_REACHED) {
-          message = $localize`Cannot create live because you created too many lives`
+          this.notifier.error(message)
         }
-
-        this.notifier.error(message)
-      }
-    )
+      })
   }
 
   updateSecondStep () {
@@ -123,19 +124,19 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
       this.updateVideoAndCaptions(video),
 
       this.liveVideoService.updateLive(this.videoId, liveVideoUpdate)
-    ]).subscribe(
-      () => {
+    ]).subscribe({
+      next: () => {
         this.notifier.success($localize`Live published.`)
 
         this.router.navigateByUrl(Video.buildWatchUrl(video))
       },
 
-      err => {
+      error: err => {
         this.error = err.message
         scrollToTop()
         console.error(err)
       }
-    )
+    })
   }
 
   getMaxLiveDuration () {
@@ -148,15 +149,15 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
 
   private fetchVideoLive () {
     this.liveVideoService.getVideoLive(this.videoId)
-      .subscribe(
-        liveVideo => {
+      .subscribe({
+        next: liveVideo => {
           this.liveVideo = liveVideo
         },
 
-        err => {
+        error: err => {
           this.firstStepError.emit()
           this.notifier.error(err.message)
         }
-      )
+      })
   }
 }
index 62aaeb01926918f530813c996633df700975dd80..fef1f5d65a353b5a6fb8414d8f5a8f04cdce0cf0 100644 (file)
@@ -88,40 +88,41 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Af
 
     this.loadingBar.useRef().start()
 
-    this.videoImportService.importVideoTorrent(torrentfile || this.magnetUri, videoUpdate).subscribe(
-      res => {
-        this.loadingBar.useRef().complete()
-        this.firstStepDone.emit(res.video.name)
-        this.isImportingVideo = false
-        this.hasImportedVideo = true
-
-        this.video = new VideoEdit(Object.assign(res.video, {
-          commentsEnabled: videoUpdate.commentsEnabled,
-          downloadEnabled: videoUpdate.downloadEnabled,
-          privacy: { id: this.firstStepPrivacyId },
-          support: null,
-          thumbnailUrl: null,
-          previewUrl: null
-        }))
-
-        hydrateFormFromVideo(this.form, this.video, false)
-      },
-
-      err => {
-        this.loadingBar.useRef().complete()
-        this.isImportingVideo = false
-        this.firstStepError.emit()
-
-        let message = err.message
-
-        const error = err.body as PeerTubeProblemDocument
-        if (error?.code === ServerErrorCode.INCORRECT_FILES_IN_TORRENT) {
-          message = $localize`Torrents with only 1 file are supported.`
-        }
+    this.videoImportService.importVideoTorrent(torrentfile || this.magnetUri, videoUpdate)
+      .subscribe({
+        next: res => {
+          this.loadingBar.useRef().complete()
+          this.firstStepDone.emit(res.video.name)
+          this.isImportingVideo = false
+          this.hasImportedVideo = true
+
+          this.video = new VideoEdit(Object.assign(res.video, {
+            commentsEnabled: videoUpdate.commentsEnabled,
+            downloadEnabled: videoUpdate.downloadEnabled,
+            privacy: { id: this.firstStepPrivacyId },
+            support: null,
+            thumbnailUrl: null,
+            previewUrl: null
+          }))
+
+          hydrateFormFromVideo(this.form, this.video, false)
+        },
+
+        error: err => {
+          this.loadingBar.useRef().complete()
+          this.isImportingVideo = false
+          this.firstStepError.emit()
+
+          let message = err.message
+
+          const error = err.body as PeerTubeProblemDocument
+          if (error?.code === ServerErrorCode.INCORRECT_FILES_IN_TORRENT) {
+            message = $localize`Torrents with only 1 file are supported.`
+          }
 
-        this.notifier.error(message)
-      }
-    )
+          this.notifier.error(message)
+        }
+      })
   }
 
   updateSecondStep () {
@@ -135,19 +136,19 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Af
 
     // Update the video
     this.updateVideoAndCaptions(this.video)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.isUpdatingVideo = false
             this.notifier.success($localize`Video to import updated.`)
 
             this.router.navigate([ '/my-library', 'video-imports' ])
           },
 
-          err => {
+          error: err => {
             this.error = err.message
             scrollToTop()
             console.error(err)
           }
-        )
+        })
   }
 }
index 3243b4d3846871aefa4b4e476b7dd43fa5b14833..e1893b28f141bc21fab6cde47cfdd0597d22d126 100644 (file)
@@ -6,7 +6,7 @@ import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers'
 import { FormValidatorService } from '@app/shared/shared-forms'
 import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
 import { LoadingBarService } from '@ngx-loading-bar/core'
-import { VideoPrivacy, VideoUpdate } from '@shared/models'
+import { VideoUpdate } from '@shared/models'
 import { hydrateFormFromVideo } from '../shared/video-edit-utils'
 import { VideoSend } from './video-send'
 
@@ -86,8 +86,8 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV
                 )
           })
         )
-        .subscribe(
-          ({ video, videoCaptions }) => {
+        .subscribe({
+          next: ({ video, videoCaptions }) => {
             this.loadingBar.useRef().complete()
             this.firstStepDone.emit(video.name)
             this.isImportingVideo = false
@@ -117,13 +117,13 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV
             hydrateFormFromVideo(this.form, this.video, true)
           },
 
-          err => {
+          error: err => {
             this.loadingBar.useRef().complete()
             this.isImportingVideo = false
             this.firstStepError.emit()
             this.notifier.error(err.message)
           }
-        )
+        })
   }
 
   updateSecondStep () {
@@ -137,19 +137,19 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV
 
     // Update the video
     this.updateVideoAndCaptions(this.video)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.isUpdatingVideo = false
             this.notifier.success($localize`Video to import updated.`)
 
             this.router.navigate([ '/my-library', 'video-imports' ])
           },
 
-          err => {
+          error: err => {
             this.error = err.message
             scrollToTop()
             console.error(err)
           }
-        )
+        })
   }
 }
index 189bc966977b20671385fc4524d18e42d4cfc211..b8cb4fa1e5904b52c6c6fbdf399c13d5c53c989e 100644 (file)
@@ -240,8 +240,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
     this.isUpdatingVideo = true
 
     this.updateVideoAndCaptions(video)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.isUpdatingVideo = false
             this.isUploadingVideo = false
 
@@ -249,12 +249,12 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
             this.router.navigateByUrl(Video.buildWatchUrl(video))
           },
 
-          err => {
+          error: err => {
             this.error = err.message
             scrollToTop()
             console.error(err)
           }
-        )
+        })
   }
 
   private getInputVideoFile () {
index 1534eee82f80c3a68d4ae446dbe18fdf0ec5ee13..95336dc756add64437fad5e172a6c28470ab2f08 100644 (file)
@@ -47,34 +47,35 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
 
     this.route.data
         .pipe(map(data => data.videoData))
-        .subscribe(({ video, videoChannels, videoCaptions, liveVideo }) => {
-          this.video = new VideoEdit(video)
-          this.videoDetails = video
-
-          this.userVideoChannels = videoChannels
-          this.videoCaptions = videoCaptions
-          this.liveVideo = liveVideo
-
-          this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE
-
-          // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout
-          setTimeout(() => {
-            hydrateFormFromVideo(this.form, this.video, true)
-
-            if (this.liveVideo) {
-              this.form.patchValue({
-                saveReplay: this.liveVideo.saveReplay,
-                permanentLive: this.liveVideo.permanentLive
-              })
-            }
-          })
-        },
+        .subscribe({
+          next: ({ video, videoChannels, videoCaptions, liveVideo }) => {
+            this.video = new VideoEdit(video)
+            this.videoDetails = video
+
+            this.userVideoChannels = videoChannels
+            this.videoCaptions = videoCaptions
+            this.liveVideo = liveVideo
+
+            this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE
+
+            // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout
+            setTimeout(() => {
+              hydrateFormFromVideo(this.form, this.video, true)
+
+              if (this.liveVideo) {
+                this.form.patchValue({
+                  saveReplay: this.liveVideo.saveReplay,
+                  permanentLive: this.liveVideo.permanentLive
+                })
+              }
+            })
+          },
 
-        err => {
-          console.error(err)
-          this.notifier.error(err.message)
-        }
-      )
+          error: err => {
+            console.error(err)
+            this.notifier.error(err.message)
+          }
+        })
   }
 
   @HostListener('window:beforeunload', [ '$event' ])
@@ -150,8 +151,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
             return this.liveVideoService.updateLive(this.video.id, liveVideoUpdate)
           })
         )
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.updateDone = true
             this.isUpdatingVideo = false
             this.loadingBar.useRef().complete()
@@ -159,13 +160,13 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
             this.router.navigateByUrl(Video.buildWatchUrl(this.video))
           },
 
-          err => {
+          error: err => {
             this.loadingBar.useRef().complete()
             this.isUpdatingVideo = false
             this.notifier.error(err.message)
             console.error(err)
           }
-        )
+        })
   }
 
   hydratePluginFieldsFromVideo () {
index ecb5a9281100c52b1bb9a996212c147f6cc6c292..48d48f33f41320f6b247a46b107b4be8f766b74d 100644 (file)
@@ -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) {
index 78efe16843008bdf2d1c28c7f601a4b28b394d28..ac65f72604076bd0c0b30a5d5196ab7406bddeaa 100644 (file)
@@ -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 () {
index 0e1c4c2070077fe3c747f79df363297f4c604e8f..f858f4750756b36a8a98b5b93dc0f50ee157fb60 100644 (file)
@@ -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)
+          })
     }
   }
 
index 2c39e63fbd372526ef483a604e0a3518000a3f0b..72866b8741cc46451c753ac38d5cf795b156121a 100644 (file)
@@ -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
   }
index 870c7ae3f6520ebebc44c5368fb073a7cef74f68..e002b3c2212d36e4b090e9d68d44bc6b3d0188b9 100644 (file)
@@ -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) {
index 8b3ed496464b74c195cadde42988fa0ce9394f38..f0f7966b17ebe2a6f6fc3dec8f4be861ba5a608e 100644 (file)
@@ -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)
+        })
     }
   }
 
index 89b9c01b6295638d05c207707c37d366aaf152ac..7f3703c084f15f38d0d0e8a081fa77ebf5959735 100644 (file)
@@ -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)
+        })
     }
   }
 }
index ccb9c5e718e7a384e64a15484f01bda27c4fb637..85100b653798d89c24b254dfa023544cba3b7551 100644 (file)
@@ -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) {
index 14532ca1ed02b8a4fcbfb29d953c955c38a19921..b32e8f3813de52b0a23a3def5c53136e544de465 100644 (file)
@@ -68,8 +68,8 @@ export class VideoOverviewComponent implements OnInit {
     this.isLoading = true
 
     this.overviewService.getVideosOverview(this.currentPage)
-        .subscribe(
-          overview => {
+        .subscribe({
+          next: overview => {
             this.isLoading = false
 
             if (overview.tags.length === 0 && overview.channels.length === 0 && overview.categories.length === 0) {
@@ -85,10 +85,10 @@ export class VideoOverviewComponent implements OnInit {
             this.overviews.push(overview)
           },
 
-          err => {
+          error: err => {
             this.notifier.error(err.message)
             this.isLoading = false
           }
-        )
+        })
   }
 }
index 6aabb93a58c482a6e4afd86740d6c77cd5d95f14..a1498e797ca86dc5f063698b1ea3f8af69929291 100644 (file)
@@ -56,8 +56,8 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement
 
     this.authService.userInformationLoaded
       .pipe(switchMap(() => this.scopedTokensService.getScopedTokens()))
-      .subscribe(
-        tokens => {
+      .subscribe({
+        next: tokens => {
           const feeds = this.videoService.getVideoSubscriptionFeedUrls(user.account.id, tokens.feedToken)
           feedUrl = feedUrl + feeds.find(f => f.format === FeedFormat.RSS).url
 
@@ -74,10 +74,10 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement
           })
         },
 
-        err => {
+        error: err => {
           this.notifier.error(err.message)
         }
-      )
+      })
   }
 
   ngOnDestroy () {
index ef5a3808e52ab10e40a897497c08f5ef2c0ade7e..5da66c981da42d25e892a48933b6fe5a2a4d1708 100644 (file)
@@ -80,8 +80,8 @@ export class AuthService {
     // Fetch the client_id/client_secret
     this.http.get<OAuthClientLocal>(AuthService.BASE_CLIENT_URL)
         .pipe(catchError(res => this.restExtractor.handleError(res)))
-        .subscribe(
-          res => {
+        .subscribe({
+          next: res => {
             this.clientId = res.client_id
             this.clientSecret = res.client_secret
 
@@ -91,18 +91,18 @@ export class AuthService {
             console.log('Client credentials loaded.')
           },
 
-          error => {
-            let errorMessage = error.message
+          error: err => {
+            let errorMessage = err.message
 
-            if (error.status === HttpStatusCode.FORBIDDEN_403) {
-              errorMessage = $localize`Cannot retrieve OAuth Client credentials: ${error.text}.
+            if (err.status === HttpStatusCode.FORBIDDEN_403) {
+              errorMessage = $localize`Cannot retrieve OAuth Client credentials: ${err.text}.
 Ensure you have correctly configured PeerTube (config/ directory), in particular the "webserver" section.`
             }
 
             // We put a bigger timeout: this is an important message
             this.notifier.error(errorMessage, $localize`Error`, 7000)
           }
-        )
+        })
   }
 
   getRefreshToken () {
@@ -168,15 +168,15 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
     const headers = new HttpHeaders().set('Authorization', authHeaderValue)
 
     this.http.post<{ redirectUrl?: string }>(AuthService.BASE_REVOKE_TOKEN_URL, {}, { headers })
-    .subscribe(
-      res => {
-        if (res.redirectUrl) {
-          window.location.href = res.redirectUrl
-        }
-      },
+      .subscribe({
+        next: res => {
+          if (res.redirectUrl) {
+            window.location.href = res.redirectUrl
+          }
+        },
 
-      err => console.error(err)
-    )
+        error: err => console.error(err)
+      })
 
     this.user = null
 
@@ -215,9 +215,9 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
                                              this.logout()
                                              this.router.navigate([ '/login' ])
 
-                                             return observableThrowError({
+                                             return observableThrowError(() => ({
                                                error: $localize`You need to reconnect.`
-                                             })
+                                             }))
                                            }),
                                            share()
                                          )
@@ -234,14 +234,14 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
     }
 
     this.mergeUserInformation(obj)
-        .subscribe(
-          res => {
+        .subscribe({
+          next: res => {
             this.user.patch(res)
             this.user.save()
 
             this.userInformationLoaded.next(true)
           }
-        )
+        })
   }
 
   private mergeUserInformation (obj: UserLoginWithUsername): Observable<UserLoginWithUserInformation> {
index 6e042c16bf5f99485b0b58efdcc749e65a52b5f9..338b8762c97d83a3dcd5d96b9c6cc0f5f16dce24 100644 (file)
@@ -1,6 +1,5 @@
-import { first } from 'rxjs/operators'
+import { firstValueFrom, Subject } from 'rxjs'
 import { Injectable } from '@angular/core'
-import { Subject } from 'rxjs'
 
 type ConfirmOptions = {
   title: string
@@ -18,16 +17,12 @@ export class ConfirmService {
   confirm (message: string, title = '', confirmButtonText?: string) {
     this.showConfirm.next({ title, message, confirmButtonText })
 
-    return this.confirmResponse.asObservable()
-               .pipe(first())
-               .toPromise()
+    return firstValueFrom(this.confirmResponse.asObservable())
   }
 
   confirmWithInput (message: string, inputLabel: string, expectedInputValue: string, title = '', confirmButtonText?: string) {
     this.showConfirm.next({ title, message, inputLabel, expectedInputValue, confirmButtonText })
 
-    return this.confirmResponse.asObservable()
-               .pipe(first())
-               .toPromise()
+    return firstValueFrom(this.confirmResponse.asObservable())
   }
 }
index 16108e17a866664926bc53c94fc535dc2df2584f..774c039647afb1dbb4e00e1822a5c5f51b2b0e23 100644 (file)
@@ -1,4 +1,4 @@
-import { Observable, of } from 'rxjs'
+import { firstValueFrom, Observable, of } from 'rxjs'
 import { catchError, map, shareReplay } from 'rxjs/operators'
 import { HttpClient } from '@angular/common/http'
 import { Inject, Injectable, LOCALE_ID, NgZone } from '@angular/core'
@@ -164,18 +164,20 @@ export class PluginService implements ClientHook {
       getSettings: () => {
         const path = PluginService.BASE_PLUGIN_API_URL + '/' + npmName + '/public-settings'
 
-        return this.authHttp.get<PublicServerSetting>(path)
+        const obs = this.authHttp.get<PublicServerSetting>(path)
                    .pipe(
                      map(p => p.publicSettings),
                      catchError(res => this.restExtractor.handleError(res))
                    )
-                   .toPromise()
+
+        return firstValueFrom(obs)
       },
 
       getServerConfig: () => {
-        return this.server.getConfig()
+        const obs = this.server.getConfig()
           .pipe(catchError(res => this.restExtractor.handleError(res)))
-          .toPromise()
+
+        return firstValueFrom(obs)
       },
 
       isLoggedIn: () => {
@@ -216,10 +218,11 @@ export class PluginService implements ClientHook {
       },
 
       translate: (value: string) => {
-        return this.translationsObservable
+        const obs = this.translationsObservable
             .pipe(map(allTranslations => allTranslations[npmName]))
             .pipe(map(translations => peertubeTranslate(value, translations)))
-            .toPromise()
+
+        return firstValueFrom(obs)
       }
     }
   }
index 2a926e68f10c286f0618193742949eb41d04d326..29a56ba39203cad2130f1c58c15bc7a24a87460f 100644 (file)
@@ -89,7 +89,7 @@ export class RestExtractor {
       errorObj.body = err.error
     }
 
-    return observableThrowError(errorObj)
+    return observableThrowError(() => errorObj)
   }
 
   redirectTo404IfNotFound (obj: { status: number }, type: 'video' | 'other', status = [ HttpStatusCode.NOT_FOUND_404 ]) {
@@ -98,6 +98,6 @@ export class RestExtractor {
       this.router.navigate([ '/404' ], { state: { type, obj }, skipLocationChange: true })
     }
 
-    return observableThrowError(obj)
+    return observableThrowError(() => obj)
   }
 }
index b7d9e9abb4af6e3bb8552cc37bddac09c9d299e5..ac9c7999153e2324c27b3a25d5fc9e2a3e9e284a 100644 (file)
@@ -36,14 +36,14 @@ export class NotificationComponent implements OnInit, OnDestroy {
 
   ngOnInit () {
     this.userNotificationService.countUnreadNotifications()
-        .subscribe(
-          result => {
+        .subscribe({
+          next: result => {
             this.unreadNotifications = Math.min(result, 99) // Limit number to 99
             this.subscribeToNotifications()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
 
     this.routeSub = this.router.events
                         .pipe(filter(event => event instanceof NavigationEnd))
index 8bf7672bec21a55d01b0a8d0f98fa8c47bb0c1fa..e4095897661805db231947fb66e4ffcdfe7a6f72 100644 (file)
@@ -50,10 +50,10 @@ export class InstanceConfigWarningModalComponent {
     peertubeLocalStorage.setItem(this.LOCAL_STORAGE_KEYS.NO_INSTANCE_CONFIG_WARNING_MODAL, 'true')
 
     this.userService.updateMyProfile({ noInstanceConfigWarningModal: true })
-        .subscribe(
-          () => console.log('We will not open the instance config warning modal again.'),
+        .subscribe({
+          next: () => console.log('We will not open the instance config warning modal again.'),
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 }
index 99859a1a50572e28f0ddbc2951e8ea2bf8386be1..7a53179cb47ac0df3eb578ac468d2f0833fb51ef 100644 (file)
@@ -31,20 +31,20 @@ export class QuickSettingsModalComponent extends FormReactive implements OnInit
   ngOnInit () {
     this.user = this.userService.getAnonymousUser()
     this.localStorageService.watch()
-      .subscribe(
-        () => this.user = this.userService.getAnonymousUser()
-      )
+      .subscribe({
+        next: () => this.user = this.userService.getAnonymousUser()
+      })
 
     this.userInformationLoaded.next(true)
 
     this.authService.loginChangedSource
       .pipe(filter(status => status !== AuthStatus.LoggedIn))
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.user = this.userService.getAnonymousUser()
           this.userInformationLoaded.next(true)
         }
-      )
+      })
   }
 
   isUserLoggedIn () {
index 72ae20b43eb86148875b65ef1e5eb81b1a93c4f3..06fe4cba51fcea887c0c3e53c6068e814229b9c6 100644 (file)
@@ -37,10 +37,10 @@ export class WelcomeModalComponent {
     peertubeLocalStorage.setItem(this.LOCAL_STORAGE_KEYS.NO_WELCOME_MODAL, 'true')
 
     this.userService.updateMyProfile({ noWelcomeModal: true })
-      .subscribe(
-        () => console.log('We will not open the welcome modal again.'),
+      .subscribe({
+        next: () => console.log('We will not open the welcome modal again.'),
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 }
index a7932ebabd6127e93edd0e2020f24b0c33c8b7cd..e3bf9e1fb48f53c731e069945cc978f3fadde843 100644 (file)
@@ -145,23 +145,24 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
     const res = await this.confirmService.confirm($localize`Do you really want to delete this abuse report?`, $localize`Delete`)
     if (res === false) return
 
-    this.abuseService.removeAbuse(abuse).subscribe(
-      () => {
-        this.notifier.success($localize`Abuse deleted.`)
-        this.reloadData()
-      },
+    this.abuseService.removeAbuse(abuse)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`Abuse deleted.`)
+          this.reloadData()
+        },
 
-      err => this.notifier.error(err.message)
-    )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   updateAbuseState (abuse: AdminAbuse, state: AbuseState) {
     this.abuseService.updateAbuse(abuse, { state })
-      .subscribe(
-        () => this.reloadData(),
+      .subscribe({
+        next: () => this.reloadData(),
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   onCountMessagesUpdated (event: { abuseId: number, countMessages: number }) {
@@ -198,55 +199,55 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
       ? this.abuseService.getAdminAbuses(options)
       : this.abuseService.getUserAbuses(options)
 
-    return observable.subscribe(
-        async resultList => {
-          this.totalRecords = resultList.total
+    return observable.subscribe({
+      next: async resultList => {
+        this.totalRecords = resultList.total
 
-          this.abuses = []
+        this.abuses = []
 
-          for (const a of resultList.data) {
-            const abuse = a as ProcessedAbuse
+        for (const a of resultList.data) {
+          const abuse = a as ProcessedAbuse
 
-            abuse.reasonHtml = await this.toHtml(abuse.reason)
+          abuse.reasonHtml = await this.toHtml(abuse.reason)
 
-            if (abuse.moderationComment) {
-              abuse.moderationCommentHtml = await this.toHtml(abuse.moderationComment)
-            }
+          if (abuse.moderationComment) {
+            abuse.moderationCommentHtml = await this.toHtml(abuse.moderationComment)
+          }
 
-            if (abuse.video) {
-              abuse.embedHtml = this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse))
+          if (abuse.video) {
+            abuse.embedHtml = this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse))
 
-              if (abuse.video.channel?.ownerAccount) {
-                abuse.video.channel.ownerAccount = new Account(abuse.video.channel.ownerAccount)
-              }
+            if (abuse.video.channel?.ownerAccount) {
+              abuse.video.channel.ownerAccount = new Account(abuse.video.channel.ownerAccount)
             }
+          }
 
-            if (abuse.comment) {
-              if (abuse.comment.deleted) {
-                abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment`
-              } else {
-                const truncated = truncate(abuse.comment.text, { length: 100 })
-                abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML(truncated, true)
-                abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML(abuse.comment.text, true)
-              }
+          if (abuse.comment) {
+            if (abuse.comment.deleted) {
+              abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment`
+            } else {
+              const truncated = truncate(abuse.comment.text, { length: 100 })
+              abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML(truncated, true)
+              abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML(abuse.comment.text, true)
             }
+          }
 
-            if (abuse.reporterAccount) {
-              abuse.reporterAccount = new Account(abuse.reporterAccount)
-            }
+          if (abuse.reporterAccount) {
+            abuse.reporterAccount = new Account(abuse.reporterAccount)
+          }
 
-            if (abuse.flaggedAccount) {
-              abuse.flaggedAccount = new Account(abuse.flaggedAccount)
-            }
+          if (abuse.flaggedAccount) {
+            abuse.flaggedAccount = new Account(abuse.flaggedAccount)
+          }
 
-            if (abuse.updatedAt === abuse.createdAt) delete abuse.updatedAt
+          if (abuse.updatedAt === abuse.createdAt) delete abuse.updatedAt
 
-            this.abuses.push(abuse)
-          }
-        },
+          this.abuses.push(abuse)
+        }
+      },
 
-        err => this.notifier.error(err.message)
-      )
+      error: err => this.notifier.error(err.message)
+    })
   }
 
   private buildInternalActions (): DropdownAction<ProcessedAbuse>[] {
@@ -351,15 +352,15 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
         isDisplayed: abuse => abuse.video && !abuse.video.deleted && !abuse.video.blacklisted,
         handler: abuse => {
           this.videoBlocklistService.blockVideo(abuse.video.id, undefined, abuse.video.channel.isLocal)
-            .subscribe(
-              () => {
+            .subscribe({
+              next: () => {
                 this.notifier.success($localize`Video blocked.`)
 
                 this.updateAbuseState(abuse, AbuseState.ACCEPTED)
               },
 
-              err => this.notifier.error(err.message)
-            )
+              error: err => this.notifier.error(err.message)
+            })
         }
       },
       {
@@ -367,15 +368,15 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
         isDisplayed: abuse => abuse.video && !abuse.video.deleted && abuse.video.blacklisted,
         handler: abuse => {
           this.videoBlocklistService.unblockVideo(abuse.video.id)
-            .subscribe(
-              () => {
+            .subscribe({
+              next: () => {
                 this.notifier.success($localize`Video unblocked.`)
 
                 this.updateAbuseState(abuse, AbuseState.ACCEPTED)
               },
 
-              err => this.notifier.error(err.message)
-            )
+              error: err => this.notifier.error(err.message)
+            })
         }
       },
       {
@@ -389,15 +390,15 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
           if (res === false) return
 
           this.videoService.removeVideo(abuse.video.id)
-            .subscribe(
-              () => {
+            .subscribe({
+              next: () => {
                 this.notifier.success($localize`Video deleted.`)
 
                 this.updateAbuseState(abuse, AbuseState.ACCEPTED)
               },
 
-              err => this.notifier.error(err.message)
-            )
+              error: err => this.notifier.error(err.message)
+            })
         }
       }
     ]
@@ -424,15 +425,15 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
           if (res === false) return
 
           this.commentService.deleteVideoComment(abuse.comment.video.id, abuse.comment.id)
-            .subscribe(
-              () => {
+            .subscribe({
+              next: () => {
                 this.notifier.success($localize`Comment deleted.`)
 
                 this.updateAbuseState(abuse, AbuseState.ACCEPTED)
               },
 
-              err => this.notifier.error(err.message)
-            )
+              error: err => this.notifier.error(err.message)
+            })
         }
       }
     ]
@@ -440,25 +441,25 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
 
   private muteAccountHelper (account: Account) {
     this.blocklistService.blockAccountByInstance(account)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.notifier.success($localize`Account ${account.nameWithHost} muted by the instance.`)
           account.mutedByInstance = true
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   private muteServerHelper (host: string) {
     this.blocklistService.blockServerByInstance(host)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.notifier.success($localize`Server ${host} muted by the instance.`)
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   private toHtml (text: string) {
index 9abb4c094e21fe93151dc3cf976bf6895964d374..6c8dc6d35e102777a2276377ee0291a5b5f08db6 100644 (file)
@@ -61,8 +61,8 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit {
     this.sendingMessage = true
 
     this.abuseService.addAbuseMessage(this.abuse, this.form.value['message'])
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.form.reset()
           this.sendingMessage = false
           this.countMessagesUpdated.emit({ abuseId: this.abuse.id, countMessages: this.abuseMessages.length + 1 })
@@ -70,25 +70,25 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit {
           this.loadMessages()
         },
 
-        err => {
+        error: err => {
           this.sendingMessage = false
           console.error(err)
           this.notifier.error('Sorry but you cannot send this message. Please retry later')
         }
-      )
+      })
   }
 
   deleteMessage (abuseMessage: AbuseMessage) {
     this.abuseService.deleteAbuseMessage(this.abuse, abuseMessage)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.countMessagesUpdated.emit({ abuseId: this.abuse.id, countMessages: this.abuseMessages.length - 1 })
 
           this.abuseMessages = this.abuseMessages.filter(m => m.id !== abuseMessage.id)
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   isMessageByMe (abuseMessage: AbuseMessage) {
@@ -105,8 +105,8 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit {
 
   private loadMessages () {
     this.abuseService.listAbuseMessages(this.abuse)
-      .subscribe(
-        async res => {
+      .subscribe({
+        next: async res => {
           this.abuseMessages = []
 
           for (const m of res.data) {
@@ -124,8 +124,8 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit {
           })
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
 }
index 876aeea8a7eecb75471d97e4946733ef53aaa6ba..06f1555ea1a575f025fe33d2258b610fafc6592c 100644 (file)
@@ -53,16 +53,16 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI
     const moderationComment: string = this.form.value[ 'moderationComment' ]
 
     this.abuseService.updateAbuse(this.abuseToComment, { moderationComment })
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Comment updated.`)
 
             this.commentUpdated.emit(moderationComment)
             this.hide()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
 }
index c9d33980ef466f0ac1af9ea09be3412c57270566..63f2f76f56fad2881bac82918d6181418c941a47 100644 (file)
@@ -1,4 +1,4 @@
-import { first } from 'rxjs/operators'
+import { firstValueFrom } from 'rxjs'
 import { ComponentRef, Injectable } from '@angular/core'
 import { MarkdownService } from '@app/core'
 import {
@@ -85,7 +85,7 @@ export class CustomMarkupService {
             const component = this.execAngularBuilder(selector, e)
 
             if (component.instance.loaded) {
-              const p = component.instance.loaded.pipe(first()).toPromise()
+              const p = firstValueFrom(component.instance.loaded)
               loadedPromises.push(p)
             }
 
index 5bb045a8230ff6dfe60358ed29caafbd39167dd5..8c1357d7a1b93b8230cfe37df542ace346fec575 100644 (file)
@@ -44,14 +44,14 @@ export class ChannelMiniatureMarkupComponent implements CustomMarkupComponent, O
         tap(html => this.descriptionHTML = html),
         switchMap(() => this.loadVideosObservable()),
         finalize(() => this.loaded.emit(true))
-      ).subscribe(
-        ({ total, data }) => {
+      ).subscribe({
+        next: ({ total, data }) => {
           this.totalVideos = total
           this.video = data[0]
         },
 
-        err => this.notifier.error($localize`Error in channel miniature component: ${err.message}`)
-      )
+        error: err => this.notifier.error($localize`Error in channel miniature component: ${err.message}`)
+      })
   }
 
   getVideoChannelLink () {
index 5a5c348670275a8c07ab9470f9459da9bce29670..07fa6fd2d29cb5fe2c9d4bf93be25c994b96e70a 100644 (file)
@@ -41,10 +41,10 @@ export class PlaylistMiniatureMarkupComponent implements CustomMarkupComponent,
   ngOnInit () {
     this.findInBulkService.getPlaylist(this.uuid)
       .pipe(finalize(() => this.loaded.emit(true)))
-      .subscribe(
-        playlist => this.playlist = playlist,
+      .subscribe({
+        next: playlist => this.playlist = playlist,
 
-        err => this.notifier.error($localize`Error in playlist miniature component: ${err.message}`)
-      )
+        error: err => this.notifier.error($localize`Error in playlist miniature component: ${err.message}`)
+      })
   }
 }
index 84c936ee74a543e65b06f1adb49d7d03886ae488..56b43d85e287668d69463d9cb3c48b6e11f827b8 100644 (file)
@@ -53,10 +53,10 @@ export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnI
 
     this.findInBulk.getVideo(this.uuid)
       .pipe(finalize(() => this.loaded.emit(true)))
-      .subscribe(
-        video => this.video = video,
+      .subscribe({
+        next: video => this.video = video,
 
-        err => this.notifier.error($localize`Error in video miniature component: ${err.message}`)
-      )
+        error: err => this.notifier.error($localize`Error in video miniature component: ${err.message}`)
+      })
   }
 }
index 6473e9ba064f500ba00f1af254a6c59fb379ea5f..856e4368183441568f9bec6d2ead7fd024b9f958 100644 (file)
@@ -71,11 +71,11 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
 
     return this.getVideosObservable()
       .pipe(finalize(() => this.loaded.emit(true)))
-      .subscribe(
-        ({ data }) => this.videos = data,
+      .subscribe({
+        next: ({ data }) => this.videos = data,
 
-        err => this.notifier.error($localize`Error in videos list component: ${err.message}`)
-      )
+        error: err => this.notifier.error($localize`Error in videos list component: ${err.message}`)
+      })
   }
 
   getVideosObservable () {
index 8e7bf2021c8758b0c08eaac36a715ecdd97b42ad..855c06aa195d68404e6edfc2e9217b66006ca6bb 100644 (file)
@@ -36,8 +36,8 @@ export class InstanceAboutAccordionComponent implements OnInit {
 
   ngOnInit (): void {
     this.instanceService.getAbout()
-      .subscribe(
-        async about => {
+      .subscribe({
+        next: async about => {
           this.about = about
 
           this.aboutHtml = await this.instanceService.buildHtml(about)
@@ -45,8 +45,8 @@ export class InstanceAboutAccordionComponent implements OnInit {
           this.init.emit(this)
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   getAdministratorsPanel () {
index a75c8a25c7c29b3dd797829c50f6ad4011b5c0c2..51248c7b26e5e0920c8dbe95ccdeffff1b8aedc4 100644 (file)
@@ -36,7 +36,7 @@ export class AuthInterceptor implements HttpInterceptor {
                      return this.handleNotAuthenticated(err)
                    }
 
-                   return observableThrowError(err)
+                   return observableThrowError(() => err)
                  })
                )
   }
index 96b141543d04758ead52dee960d7d8de3a10dd35..50005b855f3513fb0408457ee4960c4ef1f097f6 100644 (file)
@@ -56,8 +56,8 @@ export class UserNotificationsComponent implements OnInit {
     }
 
     this.userNotificationService.listMyNotifications(options)
-        .subscribe(
-          result => {
+        .subscribe({
+          next: result => {
             this.notifications = reset ? result.data : this.notifications.concat(result.data)
             this.componentPagination.totalItems = result.total
 
@@ -66,8 +66,8 @@ export class UserNotificationsComponent implements OnInit {
             this.onDataSubject.next(result.data)
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   onNearOfBottom () {
@@ -84,26 +84,26 @@ export class UserNotificationsComponent implements OnInit {
     if (notification.read) return
 
     this.userNotificationService.markAsRead(notification)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             notification.read = true
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   markAllAsRead () {
     this.userNotificationService.markAllAsRead()
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             for (const notification of this.notifications) {
               notification.read = true
             }
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   changeSortColumn (column: string) {
index 1146aeec0b77326e3ae217089d3781b11076e527..36f2a591b5086e22ff9e1728272b75b3af8d1cc6 100644 (file)
@@ -62,13 +62,13 @@ export class GenericAccountBlocklistComponent extends RestTable implements OnIni
         search: this.search
       })
 
-    return operation.subscribe(
-      resultList => {
+    return operation.subscribe({
+      next: resultList => {
         this.blockedAccounts = resultList.data
         this.totalRecords = resultList.total
       },
 
-      err => this.notifier.error(err.message)
-    )
+      error: err => this.notifier.error(err.message)
+    })
   }
 }
index cc8875f7742c27635c05b0c3cbd6d3e797a7b1e6..4ec02f11aeba65ce4b0aba2d6e1beb196fe30fe9 100644 (file)
@@ -77,14 +77,14 @@ export class AccountReportComponent extends FormReactive implements OnInit {
       account: {
         id: this.account.id
       }
-    }).subscribe(
-      () => {
+    }).subscribe({
+      next: () => {
         this.notifier.success($localize`Account reported.`)
         this.hide()
       },
 
-      err => this.notifier.error(err.message)
-    )
+      error: err => this.notifier.error(err.message)
+    })
   }
 
   isRemote () {
index c7395c7b756ebde9674cea83971708b7c36e65ed..7c0907ce475f65934827ff816b5d095498489c15 100644 (file)
@@ -77,14 +77,14 @@ export class CommentReportComponent extends FormReactive implements OnInit {
       comment: {
         id: this.comment.id
       }
-    }).subscribe(
-      () => {
+    }).subscribe({
+      next: () => {
         this.notifier.success($localize`Comment reported.`)
         this.hide()
       },
 
-      err => this.notifier.error(err.message)
-    )
+      error: err => this.notifier.error(err.message)
+    })
   }
 
   isRemote () {
index e509ac88f124594f6f51e85017f3342de9d790ca..278d60ac66461c805f24ef69d0a283d9a7862d70 100644 (file)
@@ -108,14 +108,14 @@ export class VideoReportComponent extends FormReactive implements OnInit {
         startAt: hasStart && startAt ? startAt : undefined,
         endAt: hasEnd && endAt ? endAt : undefined
       }
-    }).subscribe(
-      () => {
+    }).subscribe({
+      next: () => {
         this.notifier.success($localize`Video reported.`)
         this.hide()
       },
 
-      err => this.notifier.error(err.message)
-    )
+      error: err => this.notifier.error(err.message)
+    })
   }
 
   isRemote () {
index 274d8f6e9cf4eb2cd1632ffd912aa24ba45a6f8a..da09b1d0e5820aab0e5e2b8fdc12a892c18e47eb 100644 (file)
@@ -88,13 +88,13 @@ export class GenericServerBlocklistComponent extends RestTable implements OnInit
         search: this.search
       })
 
-    return operation.subscribe(
-      resultList => {
+    return operation.subscribe({
+      next: resultList => {
         this.blockedServers = resultList.data
         this.totalRecords = resultList.total
       },
 
-      err => this.notifier.error(err.message)
-    )
+      error: err => this.notifier.error(err.message)
+    })
   }
 }
index afc69a1b89742235ee5d34e0a80cf93385ec5e1e..0a2d5e93a4d4b112890a619da948052bd7b1d84d 100644 (file)
@@ -47,8 +47,8 @@ export class UserBanModalComponent extends FormReactive implements OnInit {
     const reason = this.form.value['reason'] || undefined
 
     this.userService.banUsers(this.usersToBan, reason)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           const message = Array.isArray(this.usersToBan)
             ? $localize`${this.usersToBan.length} users banned.`
             : $localize`User ${this.usersToBan.username} banned.`
@@ -59,8 +59,8 @@ export class UserBanModalComponent extends FormReactive implements OnInit {
           this.hide()
         },
 
-          err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
 }
index 8c5a48d42ee4120a6498dd0797da88c5ab9b70ff..9f1e1bf9b568961debcfeb722b51e1d4708ad92e 100644 (file)
@@ -67,14 +67,14 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
     if (res === false) return
 
     this.userService.unbanUsers(user)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`User ${user.username} unbanned.`)
             this.userChanged.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   async removeUser (user: User) {
@@ -87,137 +87,139 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
     const res = await this.confirmService.confirm(message, $localize`Delete`)
     if (res === false) return
 
-    this.userService.removeUser(user).subscribe(
-      () => {
-        this.notifier.success($localize`User ${user.username} deleted.`)
-        this.userDeleted.emit()
-      },
+    this.userService.removeUser(user)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`User ${user.username} deleted.`)
+          this.userDeleted.emit()
+        },
 
-      err => this.notifier.error(err.message)
-    )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   setEmailAsVerified (user: User) {
-    this.userService.updateUser(user.id, { emailVerified: true }).subscribe(
-      () => {
-        this.notifier.success($localize`User ${user.username} email set as verified`)
-        this.userChanged.emit()
-      },
-
-      err => this.notifier.error(err.message)
-    )
+    this.userService.updateUser(user.id, { emailVerified: true })
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`User ${user.username} email set as verified`)
+          this.userChanged.emit()
+        },
+
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   blockAccountByUser (account: Account) {
     this.blocklistService.blockAccountByUser(account)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Account ${account.nameWithHost} muted.`)
 
             this.account.mutedByUser = true
             this.userChanged.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   unblockAccountByUser (account: Account) {
     this.blocklistService.unblockAccountByUser(account)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Account ${account.nameWithHost} unmuted.`)
 
             this.account.mutedByUser = false
             this.userChanged.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   blockServerByUser (host: string) {
     this.blocklistService.blockServerByUser(host)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Instance ${host} muted.`)
 
             this.account.mutedServerByUser = true
             this.userChanged.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   unblockServerByUser (host: string) {
     this.blocklistService.unblockServerByUser(host)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Instance ${host} unmuted.`)
 
             this.account.mutedServerByUser = false
             this.userChanged.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   blockAccountByInstance (account: Account) {
     this.blocklistService.blockAccountByInstance(account)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Account ${account.nameWithHost} muted by the instance.`)
 
             this.account.mutedByInstance = true
             this.userChanged.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   unblockAccountByInstance (account: Account) {
     this.blocklistService.unblockAccountByInstance(account)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Account ${account.nameWithHost} unmuted by the instance.`)
 
             this.account.mutedByInstance = false
             this.userChanged.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   blockServerByInstance (host: string) {
     this.blocklistService.blockServerByInstance(host)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Instance ${host} muted by the instance.`)
 
             this.account.mutedServerByInstance = true
             this.userChanged.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   unblockServerByInstance (host: string) {
     this.blocklistService.unblockServerByInstance(host)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Instance ${host} unmuted by the instance.`)
 
             this.account.mutedServerByInstance = false
             this.userChanged.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   async bulkRemoveCommentsOf (body: BulkRemoveCommentsOfBody) {
@@ -226,13 +228,13 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
     if (res === false) return
 
     this.bulkService.removeCommentsOf(body)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Will remove comments of this account (may take several minutes).`)
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   getRouterUserEditLink (user: User) {
index fb47989dc23394b9bb8fb1a3ac16fe9b2b3f1db0..bc69526201f523e208fb38c2df1ce5f2d3530190 100644 (file)
@@ -55,8 +55,8 @@ export class VideoBlockComponent extends FormReactive implements OnInit {
     const unfederate = this.video.isLocal ? this.form.value[ 'unfederate' ] : undefined
 
     this.videoBlocklistService.blockVideo(this.video.id, reason, unfederate)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Video blocked.`)
             this.hide()
 
@@ -66,7 +66,7 @@ export class VideoBlockComponent extends FormReactive implements OnInit {
             this.videoBlocked.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 }
index 61dd2cbc56a3d6adafc0192735b4d635c877d36b..962e374a544cf2a96e74392a4959e5c6ea11fdad 100644 (file)
@@ -1,5 +1,5 @@
 import * as debug from 'debug'
-import { Observable, Subject, throwError } from 'rxjs'
+import { Observable, Subject } from 'rxjs'
 import { first, map } from 'rxjs/operators'
 import { Injectable, NgZone } from '@angular/core'
 import { buildBulkObservable } from '@app/helpers'
index b721604e5ed3a601f78b7509eb2fb63caacec625..bd1cb0353b8c1e291778e522912c8b6fe08a0103 100644 (file)
@@ -65,18 +65,21 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
     }
 
     if (this.authService.isLoggedIn()) {
-      this.userService.updateMyProfile(details).subscribe(
-        () => {
-          this.authService.refreshUserInformation()
-
-          if (this.notifyOnUpdate) this.notifier.success($localize`Interface settings updated.`)
-        },
-
-        err => this.notifier.error(err.message)
-      )
-    } else {
-      this.userService.updateMyAnonymousProfile(details)
-      if (this.notifyOnUpdate) this.notifier.success($localize`Interface settings updated.`)
+      this.userService.updateMyProfile(details)
+        .subscribe({
+          next: () => {
+            this.authService.refreshUserInformation()
+
+            if (this.notifyOnUpdate) this.notifier.success($localize`Interface settings updated.`)
+          },
+
+          error: err => this.notifier.error(err.message)
+        })
+
+      return
     }
+
+    this.userService.updateMyAnonymousProfile(details)
+    if (this.notifyOnUpdate) this.notifier.success($localize`Interface settings updated.`)
   }
 }
index 8b0eaea4f96856ff7e3e672e202b6f04828e3c34..4aac60c2b4acb2624707e8c0f24e99cd7826691b 100644 (file)
@@ -162,15 +162,16 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit,
   }
 
   private updateLoggedProfile (details: UserUpdateMe) {
-    this.userService.updateMyProfile(details).subscribe(
-      () => {
-        this.authService.refreshUserInformation()
+    this.userService.updateMyProfile(details)
+      .subscribe({
+        next: () => {
+          this.authService.refreshUserInformation()
 
-        if (this.notifyOnUpdate) this.notifier.success($localize`Video settings updated.`)
-      },
+          if (this.notifyOnUpdate) this.notifier.success($localize`Video settings updated.`)
+        },
 
-      err => this.notifier.error(err.message)
-    )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   private updateAnonymousProfile (details: UserUpdateMe) {
index 2261e07dd5f47cda9458c35620ba5726eea074c6..796493bd976c6796212e534681c08b747746a50e 100644 (file)
@@ -102,8 +102,8 @@ export class SubscribeButtonComponent implements OnInit, OnChanges {
       .map(handle => this.userSubscriptionService.addSubscription(handle))
 
     forkJoin(observableBatch)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           this.notifier.success(
             this.account
               ? $localize`Subscribed to all current channels of ${this.account.displayName}. You will be notified of all their new videos.`
@@ -113,8 +113,8 @@ export class SubscribeButtonComponent implements OnInit, OnChanges {
           )
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   unsubscribe () {
@@ -182,11 +182,11 @@ export class SubscribeButtonComponent implements OnInit, OnChanges {
       merge(
         this.userSubscriptionService.listenToSubscriptionCacheChange(handle),
         this.userSubscriptionService.doesSubscriptionExist(handle)
-      ).subscribe(
-        res => this.subscribed.set(handle, res),
+      ).subscribe({
+        next: res => this.subscribed.set(handle, res),
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
     }
   }
 }
index 33061a837509276b5a8b0122293b86fa199bf3bf..d8b2ee17dd8328cb010418bf5cec6dc436e011fd 100644 (file)
@@ -204,28 +204,29 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte
   }
 
   loadMoreVideos (reset = false) {
-    this.getVideosObservable(this.pagination.currentPage).subscribe(
-      ({ data }) => {
-        this.hasDoneFirstQuery = true
-        this.lastQueryLength = data.length
+    this.getVideosObservable(this.pagination.currentPage)
+      .subscribe({
+        next: ({ data }) => {
+          this.hasDoneFirstQuery = true
+          this.lastQueryLength = data.length
 
-        if (reset) this.videos = []
-        this.videos = this.videos.concat(data)
+          if (reset) this.videos = []
+          this.videos = this.videos.concat(data)
 
-        if (this.groupByDate) this.buildGroupedDateLabels()
+          if (this.groupByDate) this.buildGroupedDateLabels()
 
-        this.onMoreVideos()
+          this.onMoreVideos()
 
-        this.onDataSubject.next(data)
-      },
+          this.onDataSubject.next(data)
+        },
 
-      error => {
-        const message = $localize`Cannot load more videos. Try again later.`
+        error: err => {
+          const message = $localize`Cannot load more videos. Try again later.`
 
-        console.error(message, { error })
-        this.notifier.error(message)
-      }
-    )
+          console.error(message, { err })
+          this.notifier.error(message)
+        }
+      })
   }
 
   reloadVideos () {
index 3c2b46d16d68e41d4e196cc486c1a75ac8dcf856..2ba091438bf003111c6803f29f03c634954cc381 100644 (file)
@@ -183,8 +183,8 @@ export class VideoActionsDropdownComponent implements OnChanges {
     if (res === false) return
 
     this.videoBlocklistService.unblockVideo(this.video.id)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Video ${this.video.name} unblocked.`)
 
             this.video.blacklisted = false
@@ -193,8 +193,8 @@ export class VideoActionsDropdownComponent implements OnChanges {
             this.videoUnblocked.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   async removeVideo () {
@@ -209,40 +209,40 @@ export class VideoActionsDropdownComponent implements OnChanges {
     if (res === false) return
 
     this.videoService.removeVideo(this.video.id)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Video ${this.video.name} deleted.`)
             this.videoRemoved.emit()
           },
 
-          error => this.notifier.error(error.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   duplicateVideo () {
     this.redundancyService.addVideoRedundancy(this.video)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             const message = $localize`This video will be duplicated by your instance.`
             this.notifier.success(message)
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   muteVideoAccount () {
     const params = { nameWithHost: Actor.CREATE_BY_STRING(this.video.account.name, this.video.account.host) }
 
     this.blocklistService.blockAccountByUser(params)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Account ${params.nameWithHost} muted.`)
             this.videoAccountMuted.emit()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   onVideoBlocked () {
index 355ce8be3bd04bdd81082cd2aede0e028c9dfeb7..28fefb9dddf12f4cb885eca731bea014f3ccc8fe 100644 (file)
@@ -1,4 +1,5 @@
 import { mapValues, pick } from 'lodash-es'
+import { firstValueFrom } from 'rxjs'
 import { tap } from 'rxjs/operators'
 import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core'
 import { AuthService, HooksService, Notifier } from '@app/core'
@@ -265,6 +266,6 @@ export class VideoDownloadComponent {
     const observable = this.videoService.getVideoFileMetadata(file.metadataUrl)
       .pipe(tap(res => file.metadata = res))
 
-    return observable.toPromise()
+    return firstValueFrom(observable)
   }
 }
index 67e0de6a2156cb1f7def2eadac6173b3f4bf6e9a..cb81ba3bd7ef1348cf21622173b9ff73d5c6dc06 100644 (file)
@@ -214,11 +214,12 @@ export class VideoMiniatureComponent implements OnInit {
   addToWatchLater () {
     const body = { videoId: this.video.id }
 
-    this.videoPlaylistService.addVideoInPlaylist(this.watchLaterPlaylist.id, body).subscribe(
-      res => {
-        this.watchLaterPlaylist.playlistElementId = res.videoPlaylistElement.id
-      }
-    )
+    this.videoPlaylistService.addVideoInPlaylist(this.watchLaterPlaylist.id, body)
+      .subscribe(
+        res => {
+          this.watchLaterPlaylist.playlistElementId = res.videoPlaylistElement.id
+        }
+      )
   }
 
   removeFromWatchLater () {
index 7069fa8fd3bcd188fcd5b6fc213a104bd96a316c..df3aeddb740319340aab42f326d9520326f5e59b 100644 (file)
@@ -198,15 +198,16 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
       privacy: VideoPlaylistPrivacy.PRIVATE
     }
 
-    this.videoPlaylistService.createVideoPlaylist(videoPlaylistCreate).subscribe(
-      () => {
-        this.isNewPlaylistBlockOpened = false
+    this.videoPlaylistService.createVideoPlaylist(videoPlaylistCreate)
+      .subscribe({
+        next: () => {
+          this.isNewPlaylistBlockOpened = false
 
-        this.cd.markForCheck()
-      },
+          this.cd.markForCheck()
+        },
 
-      err => this.notifier.error(err.message)
-    )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   onVideoPlaylistSearchChanged () {
@@ -268,17 +269,15 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
     }
 
     this.videoPlaylistService.updateVideoOfPlaylist(playlist.id, element.playlistElementId, body, this.video.id)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Timestamps updated`)
           },
 
-          err => {
-            this.notifier.error(err.message)
-          },
+          error: err => this.notifier.error(err.message),
 
-          () => this.cd.markForCheck()
-        )
+          complete: () => this.cd.markForCheck()
+        })
   }
 
   private isOptionalRowDisplayed (playlist: PlaylistSummary) {
@@ -302,17 +301,15 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
 
   private removeVideoFromPlaylist (playlist: PlaylistSummary, elementId: number) {
     this.videoPlaylistService.removeVideoFromPlaylist(playlist.id, elementId, this.video.id)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Video removed from ${playlist.displayName}`)
           },
 
-          err => {
-            this.notifier.error(err.message)
-          },
+          error: err => this.notifier.error(err.message),
 
-          () => this.cd.markForCheck()
-        )
+          complete: () => this.cd.markForCheck()
+        })
   }
 
   private listenToVideoPlaylistChange () {
@@ -371,8 +368,8 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
     if (element.stopTimestamp && element.stopTimestamp !== this.video.duration) body.stopTimestamp = element.stopTimestamp
 
     this.videoPlaylistService.addVideoInPlaylist(playlist.id, body)
-      .subscribe(
-        res => {
+      .subscribe({
+        next: res => {
           const message = body.startTimestamp || body.stopTimestamp
             ? $localize`Video added in ${playlist.displayName} at timestamps ${this.formatTimestamp(element)}`
             : $localize`Video added in ${playlist.displayName}`
@@ -382,12 +379,10 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
           if (element) element.playlistElementId = res.videoPlaylistElement.id
         },
 
-        err => {
-          this.notifier.error(err.message)
-        },
+        error: err => this.notifier.error(err.message),
 
-        () => this.cd.markForCheck()
-      )
+        complete: () => this.cd.markForCheck()
+      })
   }
 
   private formatTimestamp (element: PlaylistElement) {
index 2e495ec266c7a95e8a472df0840947690f4b9195..8d1e14f94d3a396dbac50b03454a9e5402fcd6de 100644 (file)
@@ -88,14 +88,14 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit {
     const videoId = this.playlistElement.video ? this.playlistElement.video.id : undefined
 
     this.videoPlaylistService.removeVideoFromPlaylist(this.playlist.id, playlistElement.id, videoId)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Video removed from ${this.playlist.displayName}`)
             this.elementRemoved.emit(playlistElement)
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
 
     this.moreDropdown.close()
   }
@@ -107,8 +107,8 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit {
     body.stopTimestamp = this.timestampOptions.stopTimestampEnabled ? this.timestampOptions.stopTimestamp : null
 
     this.videoPlaylistService.updateVideoOfPlaylist(this.playlist.id, playlistElement.id, body, this.playlistElement.video.id)
-        .subscribe(
-          () => {
+        .subscribe({
+          next: () => {
             this.notifier.success($localize`Timestamps updated`)
 
             playlistElement.startTimestamp = body.startTimestamp
@@ -117,8 +117,8 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit {
             this.cdr.detectChanges()
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
 
     this.moreDropdown.close()
   }
index f919db8afb4ebb27c1a3164c72cd7a2fd5a97959..d14ac4acd6728a120baaa3c9deb386da31fa766b 100644 (file)
@@ -1,5 +1,5 @@
 import * as debug from 'debug'
-import { ReplaySubject } from 'rxjs'
+import { firstValueFrom, ReplaySubject } from 'rxjs'
 import { first, shareReplay } from 'rxjs/operators'
 import { RegisterClientHelpers } from 'src/types/register-client-option.model'
 import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks'
@@ -102,9 +102,10 @@ class PluginsManager {
   ensurePluginsAreLoaded (scope: PluginClientScope) {
     this.loadPluginsByScope(scope)
 
-    return this.pluginsLoaded[scope].asObservable()
+    const obs = this.pluginsLoaded[scope].asObservable()
                .pipe(first(), shareReplay())
-               .toPromise()
+
+    return firstValueFrom(obs)
   }
 
   async reloadLoadedScopes () {