diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-19 09:24:29 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-25 11:24:11 +0200 |
commit | dd24f1bb0a4b252e5342b251ba36853364da7b8e (patch) | |
tree | 41a9506d07413f056fb90425705e258f96fdc77d /client/src/app/+accounts/account-search | |
parent | 2e80d256cc75b4b02c8efc3d3e4cdf57ddf401a8 (diff) | |
download | PeerTube-dd24f1bb0a4b252e5342b251ba36853364da7b8e.tar.gz PeerTube-dd24f1bb0a4b252e5342b251ba36853364da7b8e.tar.zst PeerTube-dd24f1bb0a4b252e5342b251ba36853364da7b8e.zip |
Add video filters to common video pages
Diffstat (limited to 'client/src/app/+accounts/account-search')
-rw-r--r-- | client/src/app/+accounts/account-search/account-search.component.ts | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/client/src/app/+accounts/account-search/account-search.component.ts b/client/src/app/+accounts/account-search/account-search.component.ts deleted file mode 100644 index f54ab846a..000000000 --- a/client/src/app/+accounts/account-search/account-search.component.ts +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | import { forkJoin, Subscription } from 'rxjs' | ||
2 | import { first, tap } from 'rxjs/operators' | ||
3 | import { Component, ComponentFactoryResolver, OnDestroy, OnInit } from '@angular/core' | ||
4 | import { ActivatedRoute, Router } from '@angular/router' | ||
5 | import { AuthService, ConfirmService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' | ||
6 | import { immutableAssign } from '@app/helpers' | ||
7 | import { Account, AccountService, VideoService } from '@app/shared/shared-main' | ||
8 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | ||
9 | import { VideoFilter } from '@shared/models' | ||
10 | |||
11 | @Component({ | ||
12 | selector: 'my-account-search', | ||
13 | templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html', | ||
14 | styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ] | ||
15 | }) | ||
16 | export class AccountSearchComponent extends AbstractVideoList implements OnInit, OnDestroy { | ||
17 | titlePage: string | ||
18 | loadOnInit = false | ||
19 | loadUserVideoPreferences = true | ||
20 | |||
21 | search = '' | ||
22 | filter: VideoFilter = null | ||
23 | |||
24 | private account: Account | ||
25 | private accountSub: Subscription | ||
26 | |||
27 | constructor ( | ||
28 | protected router: Router, | ||
29 | protected serverService: ServerService, | ||
30 | protected route: ActivatedRoute, | ||
31 | protected authService: AuthService, | ||
32 | protected userService: UserService, | ||
33 | protected notifier: Notifier, | ||
34 | protected confirmService: ConfirmService, | ||
35 | protected screenService: ScreenService, | ||
36 | protected storageService: LocalStorageService, | ||
37 | protected cfr: ComponentFactoryResolver, | ||
38 | private accountService: AccountService, | ||
39 | private videoService: VideoService | ||
40 | ) { | ||
41 | super() | ||
42 | } | ||
43 | |||
44 | ngOnInit () { | ||
45 | super.ngOnInit() | ||
46 | |||
47 | this.enableAllFilterIfPossible() | ||
48 | |||
49 | // Parent get the account for us | ||
50 | this.accountSub = forkJoin([ | ||
51 | this.accountService.accountLoaded.pipe(first()), | ||
52 | this.onUserLoadedSubject.pipe(first()) | ||
53 | ]).subscribe(([ account ]) => { | ||
54 | this.account = account | ||
55 | |||
56 | this.reloadVideos() | ||
57 | }) | ||
58 | } | ||
59 | |||
60 | ngOnDestroy () { | ||
61 | if (this.accountSub) this.accountSub.unsubscribe() | ||
62 | |||
63 | super.ngOnDestroy() | ||
64 | } | ||
65 | |||
66 | updateSearch (value: string) { | ||
67 | this.search = value | ||
68 | |||
69 | if (!this.search) { | ||
70 | this.router.navigate([ '../videos' ], { relativeTo: this.route }) | ||
71 | return | ||
72 | } | ||
73 | |||
74 | this.videos = [] | ||
75 | this.reloadVideos() | ||
76 | } | ||
77 | |||
78 | getVideosObservable (page: number) { | ||
79 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | ||
80 | const options = { | ||
81 | account: this.account, | ||
82 | videoPagination: newPagination, | ||
83 | sort: this.sort, | ||
84 | nsfwPolicy: this.nsfwPolicy, | ||
85 | videoFilter: this.filter, | ||
86 | search: this.search | ||
87 | } | ||
88 | |||
89 | return this.videoService | ||
90 | .getAccountVideos(options) | ||
91 | .pipe( | ||
92 | tap(({ total }) => { | ||
93 | this.titlePage = this.search | ||
94 | ? $localize`Published ${total} videos matching "${this.search}"` | ||
95 | : $localize`Published ${total} videos` | ||
96 | }) | ||
97 | ) | ||
98 | } | ||
99 | |||
100 | toggleModerationDisplay () { | ||
101 | this.filter = this.buildLocalFilter(this.filter, null) | ||
102 | |||
103 | this.reloadVideos() | ||
104 | } | ||
105 | |||
106 | generateSyndicationList () { | ||
107 | /* method disabled */ | ||
108 | throw new Error('Method not implemented.') | ||
109 | } | ||
110 | } | ||