aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+accounts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-18 15:29:38 +0100
committerChocobozzz <me@florianbigard.com>2020-11-18 15:29:38 +0100
commit0aa52e170727ac6bdf441bcaa2353ae0b8a354ed (patch)
tree52fa047cf9970590cab1dcc7a3e5caa8eb004171 /client/src/app/+accounts
parentff2cac9fa361a3c5489078f441ed54230c045971 (diff)
downloadPeerTube-0aa52e170727ac6bdf441bcaa2353ae0b8a354ed.tar.gz
PeerTube-0aa52e170727ac6bdf441bcaa2353ae0b8a354ed.tar.zst
PeerTube-0aa52e170727ac6bdf441bcaa2353ae0b8a354ed.zip
Add ability to display all channel/account videos
Diffstat (limited to 'client/src/app/+accounts')
-rw-r--r--client/src/app/+accounts/account-video-channels/account-video-channels.component.ts18
-rw-r--r--client/src/app/+accounts/account-videos/account-videos.component.ts20
2 files changed, 34 insertions, 4 deletions
diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
index 205245675..f2beb6689 100644
--- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
+++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
@@ -3,7 +3,7 @@ import { concatMap, map, switchMap, tap } from 'rxjs/operators'
3import { Component, OnDestroy, OnInit } from '@angular/core' 3import { Component, OnDestroy, OnInit } from '@angular/core'
4import { ComponentPagination, hasMoreItems, ScreenService, User, UserService } from '@app/core' 4import { ComponentPagination, hasMoreItems, ScreenService, User, UserService } from '@app/core'
5import { Account, AccountService, Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' 5import { Account, AccountService, Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main'
6import { VideoSortField } from '@shared/models' 6import { NSFWPolicyType, VideoSortField } from '@shared/models'
7 7
8@Component({ 8@Component({
9 selector: 'my-account-video-channels', 9 selector: 'my-account-video-channels',
@@ -31,6 +31,7 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
31 onChannelDataSubject = new Subject<any>() 31 onChannelDataSubject = new Subject<any>()
32 32
33 userMiniature: User 33 userMiniature: User
34 nsfwPolicy: NSFWPolicyType
34 35
35 private accountSub: Subscription 36 private accountSub: Subscription
36 37
@@ -52,7 +53,11 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
52 }) 53 })
53 54
54 this.userService.getAnonymousOrLoggedUser() 55 this.userService.getAnonymousOrLoggedUser()
55 .subscribe(user => this.userMiniature = user) 56 .subscribe(user => {
57 this.userMiniature = user
58
59 this.nsfwPolicy = user.nsfwPolicy
60 })
56 } 61 }
57 62
58 ngOnDestroy () { 63 ngOnDestroy () {
@@ -65,7 +70,14 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
65 tap(res => this.channelPagination.totalItems = res.total), 70 tap(res => this.channelPagination.totalItems = res.total),
66 switchMap(res => from(res.data)), 71 switchMap(res => from(res.data)),
67 concatMap(videoChannel => { 72 concatMap(videoChannel => {
68 return this.videoService.getVideoChannelVideos(videoChannel, this.videosPagination, this.videosSort) 73 const options = {
74 videoChannel,
75 videoPagination: this.videosPagination,
76 sort: this.videosSort,
77 nsfwPolicy: this.nsfwPolicy
78 }
79
80 return this.videoService.getVideoChannelVideos(options)
69 .pipe(map(data => ({ videoChannel, videos: data.data }))) 81 .pipe(map(data => ({ videoChannel, videos: data.data })))
70 }) 82 })
71 ) 83 )
diff --git a/client/src/app/+accounts/account-videos/account-videos.component.ts b/client/src/app/+accounts/account-videos/account-videos.component.ts
index 3134a8ee2..58d0719fd 100644
--- a/client/src/app/+accounts/account-videos/account-videos.component.ts
+++ b/client/src/app/+accounts/account-videos/account-videos.component.ts
@@ -6,6 +6,7 @@ import { AuthService, ConfirmService, LocalStorageService, Notifier, ScreenServi
6import { immutableAssign } from '@app/helpers' 6import { immutableAssign } from '@app/helpers'
7import { Account, AccountService, VideoService } from '@app/shared/shared-main' 7import { Account, AccountService, VideoService } from '@app/shared/shared-main'
8import { AbstractVideoList } from '@app/shared/shared-video-miniature' 8import { AbstractVideoList } from '@app/shared/shared-video-miniature'
9import { VideoFilter } from '@shared/models'
9 10
10@Component({ 11@Component({
11 selector: 'my-account-videos', 12 selector: 'my-account-videos',
@@ -18,6 +19,8 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,
18 titlePage: string 19 titlePage: string
19 loadOnInit = false 20 loadOnInit = false
20 21
22 filter: VideoFilter = null
23
21 private account: Account 24 private account: Account
22 private accountSub: Subscription 25 private accountSub: Subscription
23 26
@@ -40,6 +43,8 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,
40 ngOnInit () { 43 ngOnInit () {
41 super.ngOnInit() 44 super.ngOnInit()
42 45
46 this.enableAllFilterIfPossible()
47
43 // Parent get the account for us 48 // Parent get the account for us
44 this.accountSub = this.accountService.accountLoaded 49 this.accountSub = this.accountService.accountLoaded
45 .pipe(first()) 50 .pipe(first())
@@ -59,9 +64,16 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,
59 64
60 getVideosObservable (page: number) { 65 getVideosObservable (page: number) {
61 const newPagination = immutableAssign(this.pagination, { currentPage: page }) 66 const newPagination = immutableAssign(this.pagination, { currentPage: page })
67 const options = {
68 account: this.account,
69 videoPagination: newPagination,
70 sort: this.sort,
71 nsfwPolicy: this.nsfwPolicy,
72 videoFilter: this.filter
73 }
62 74
63 return this.videoService 75 return this.videoService
64 .getAccountVideos(this.account, newPagination, this.sort) 76 .getAccountVideos(options)
65 .pipe( 77 .pipe(
66 tap(({ total }) => { 78 tap(({ total }) => {
67 this.titlePage = $localize`Published ${total} videos` 79 this.titlePage = $localize`Published ${total} videos`
@@ -69,6 +81,12 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,
69 ) 81 )
70 } 82 }
71 83
84 toggleModerationDisplay () {
85 this.filter = this.buildLocalFilter(this.filter, null)
86
87 this.reloadVideos()
88 }
89
72 generateSyndicationList () { 90 generateSyndicationList () {
73 this.syndicationItems = this.videoService.getAccountFeedUrls(this.account.id) 91 this.syndicationItems = this.videoService.getAccountFeedUrls(this.account.id)
74 } 92 }