aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-library
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-20 09:05:43 +0200
committerChocobozzz <me@florianbigard.com>2021-10-20 09:25:44 +0200
commit978c87e7f58b6673fe60f04f1767bc9e02ea4936 (patch)
treee7d48735d4099fec8c7732f33e7dadb09c0eac80 /client/src/app/+my-library
parent7e76cc380040e40a2292a9dc825f037c9b538030 (diff)
downloadPeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.tar.gz
PeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.tar.zst
PeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.zip
Add channel filters for my videos/followers
Diffstat (limited to 'client/src/app/+my-library')
-rw-r--r--client/src/app/+my-library/my-follows/my-followers.component.ts11
-rw-r--r--client/src/app/+my-library/my-videos/my-videos.component.ts46
2 files changed, 47 insertions, 10 deletions
diff --git a/client/src/app/+my-library/my-follows/my-followers.component.ts b/client/src/app/+my-library/my-follows/my-followers.component.ts
index 413d524df..4a72b983f 100644
--- a/client/src/app/+my-library/my-follows/my-followers.component.ts
+++ b/client/src/app/+my-library/my-follows/my-followers.component.ts
@@ -37,12 +37,19 @@ export class MyFollowersComponent implements OnInit {
37 } 37 }
38 38
39 this.auth.userInformationLoaded.subscribe(() => { 39 this.auth.userInformationLoaded.subscribe(() => {
40 this.inputFilters = this.auth.getUser().videoChannels.map(c => { 40 const channelFilters = this.auth.getUser().videoChannels.map(c => {
41 return { 41 return {
42 queryParams: { search: 'channel:' + c.name }, 42 queryParams: { search: 'channel:' + c.name },
43 label: $localize`Followers of ${c.name}` 43 label: c.name
44 } 44 }
45 }) 45 })
46
47 this.inputFilters = [
48 {
49 title: $localize`Channel filters`,
50 children: channelFilters
51 }
52 ]
46 }) 53 })
47 } 54 }
48 55
diff --git a/client/src/app/+my-library/my-videos/my-videos.component.ts b/client/src/app/+my-library/my-videos/my-videos.component.ts
index b1f3baf80..a117d0915 100644
--- a/client/src/app/+my-library/my-videos/my-videos.component.ts
+++ b/client/src/app/+my-library/my-videos/my-videos.component.ts
@@ -9,7 +9,7 @@ import { AdvancedInputFilter } from '@app/shared/shared-forms'
9import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' 9import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
10import { LiveStreamInformationComponent } from '@app/shared/shared-video-live' 10import { LiveStreamInformationComponent } from '@app/shared/shared-video-live'
11import { MiniatureDisplayOptions, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature' 11import { MiniatureDisplayOptions, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature'
12import { VideoSortField } from '@shared/models' 12import { VideoChannel, VideoSortField } from '@shared/models'
13import { VideoChangeOwnershipComponent } from './modals/video-change-ownership.component' 13import { VideoChangeOwnershipComponent } from './modals/video-change-ownership.component'
14 14
15@Component({ 15@Component({
@@ -47,16 +47,12 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
47 47
48 user: User 48 user: User
49 49
50 inputFilters: AdvancedInputFilter[] = [ 50 inputFilters: AdvancedInputFilter[]
51 {
52 queryParams: { search: 'isLive:true' },
53 label: $localize`Only live videos`
54 }
55 ]
56 51
57 disabled = false 52 disabled = false
58 53
59 private search: string 54 private search: string
55 private userChannels: VideoChannel[] = []
60 56
61 constructor ( 57 constructor (
62 protected router: Router, 58 protected router: Router,
@@ -79,6 +75,35 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
79 if (this.route.snapshot.queryParams['search']) { 75 if (this.route.snapshot.queryParams['search']) {
80 this.search = this.route.snapshot.queryParams['search'] 76 this.search = this.route.snapshot.queryParams['search']
81 } 77 }
78
79 this.authService.userInformationLoaded.subscribe(() => {
80 this.user = this.authService.getUser()
81 this.userChannels = this.user.videoChannels
82
83 const channelFilters = this.userChannels.map(c => {
84 return {
85 queryParams: { search: 'channel:' + c.name },
86 label: c.name
87 }
88 })
89
90 this.inputFilters = [
91 {
92 title: $localize`Advanced filters`,
93 children: [
94 {
95 queryParams: { search: 'isLive:true' },
96 label: $localize`Only live videos`
97 }
98 ]
99 },
100
101 {
102 title: $localize`Channel filters`,
103 children: channelFilters
104 }
105 ]
106 })
82 } 107 }
83 108
84 onSearch (search: string) { 109 onSearch (search: string) {
@@ -105,7 +130,12 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
105 getVideosObservable (page: number) { 130 getVideosObservable (page: number) {
106 const newPagination = immutableAssign(this.pagination, { currentPage: page }) 131 const newPagination = immutableAssign(this.pagination, { currentPage: page })
107 132
108 return this.videoService.getMyVideos(newPagination, this.sort, this.search) 133 return this.videoService.getMyVideos({
134 videoPagination: newPagination,
135 sort: this.sort,
136 userChannels: this.userChannels,
137 search: this.search
138 })
109 .pipe( 139 .pipe(
110 tap(res => this.pagination.totalItems = res.total) 140 tap(res => this.pagination.totalItems = res.total)
111 ) 141 )