]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+my-library/my-videos/my-videos.component.ts
Add ability to view my followers
[github/Chocobozzz/PeerTube.git] / client / src / app / +my-library / my-videos / my-videos.component.ts
index 1e4a4406d6369d0538cdd0cc022264b8321990a3..b1f3baf80148c9f0f5883b0aad8229e185927022 100644 (file)
@@ -49,11 +49,13 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
 
   inputFilters: AdvancedInputFilter[] = [
     {
-      queryParams: { 'search': 'isLive:true' },
+      queryParams: { search: 'isLive:true' },
       label: $localize`Only live videos`
     }
   ]
 
+  disabled = false
+
   private search: string
 
   constructor (
@@ -73,6 +75,10 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
     this.buildActions()
 
     this.user = this.authService.getUser()
+
+    if (this.route.snapshot.queryParams['search']) {
+      this.search = this.route.snapshot.queryParams['search']
+    }
   }
 
   onSearch (search: string) {
@@ -89,11 +95,11 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
   }
 
   disableForReuse () {
-    this.videosSelection.disableForReuse()
+    this.disabled = true
   }
 
   enabledForReuse () {
-    this.videosSelection.enabledForReuse()
+    this.disabled = false
   }
 
   getVideosObservable (page: number) {
@@ -107,7 +113,7 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
 
   async deleteSelectedVideos () {
     const toDeleteVideosIds = Object.keys(this.selection)
-                                    .filter(k => this.selection[ k ] === true)
+                                    .filter(k => this.selection[k] === true)
                                     .map(k => parseInt(k, 10))
 
     const res = await this.confirmService.confirm(
@@ -126,14 +132,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 +150,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) {