diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-01 17:41:03 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-01 17:41:03 +0200 |
commit | 674d903b0e993b3a67836f3dabba80282d9900ab (patch) | |
tree | 0318fb7e89827a63a5257ebb250f2915be085a5b /client/src/app/shared/shared-custom-markup | |
parent | 8b61dcaf23a66d508c05641c9c09747bf03cdb48 (diff) | |
download | PeerTube-674d903b0e993b3a67836f3dabba80282d9900ab.tar.gz PeerTube-674d903b0e993b3a67836f3dabba80282d9900ab.tar.zst PeerTube-674d903b0e993b3a67836f3dabba80282d9900ab.zip |
Support accountHandle and channelHandle
Diffstat (limited to 'client/src/app/shared/shared-custom-markup')
-rw-r--r-- | client/src/app/shared/shared-custom-markup/custom-markup.service.ts | 3 | ||||
-rw-r--r-- | client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts | 25 |
2 files changed, 21 insertions, 7 deletions
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts index 15da94709..231e52d0a 100644 --- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts +++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts | |||
@@ -188,6 +188,9 @@ export class CustomMarkupService { | |||
188 | categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [], | 188 | categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [], |
189 | languageOneOf: this.buildArrayString(data.languageOneOf) ?? [], | 189 | languageOneOf: this.buildArrayString(data.languageOneOf) ?? [], |
190 | 190 | ||
191 | accountHandle: data.accountHandle || undefined, | ||
192 | channelHandle: data.channelHandle || undefined, | ||
193 | |||
191 | filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined | 194 | filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined |
192 | } | 195 | } |
193 | 196 | ||
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts index afa4f4799..d9f77802b 100644 --- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts +++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts | |||
@@ -23,6 +23,8 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit | |||
23 | @Input() onlyDisplayTitle: boolean | 23 | @Input() onlyDisplayTitle: boolean |
24 | @Input() filter: VideoFilter | 24 | @Input() filter: VideoFilter |
25 | @Input() maxRows: number | 25 | @Input() maxRows: number |
26 | @Input() channelHandle: string | ||
27 | @Input() accountHandle: string | ||
26 | 28 | ||
27 | @Output() loaded = new EventEmitter<boolean>() | 29 | @Output() loaded = new EventEmitter<boolean>() |
28 | 30 | ||
@@ -66,6 +68,16 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit | |||
66 | } | 68 | } |
67 | } | 69 | } |
68 | 70 | ||
71 | return this.getVideosObservable() | ||
72 | .pipe(finalize(() => this.loaded.emit(true))) | ||
73 | .subscribe( | ||
74 | ({ data }) => this.videos = data, | ||
75 | |||
76 | err => this.notifier.error('Error in videos list component: ' + err.message) | ||
77 | ) | ||
78 | } | ||
79 | |||
80 | getVideosObservable () { | ||
69 | const options = { | 81 | const options = { |
70 | videoPagination: { | 82 | videoPagination: { |
71 | currentPage: 1, | 83 | currentPage: 1, |
@@ -74,15 +86,14 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit | |||
74 | categoryOneOf: this.categoryOneOf, | 86 | categoryOneOf: this.categoryOneOf, |
75 | languageOneOf: this.languageOneOf, | 87 | languageOneOf: this.languageOneOf, |
76 | filter: this.filter, | 88 | filter: this.filter, |
77 | sort: this.sort as VideoSortField | 89 | sort: this.sort as VideoSortField, |
90 | account: { nameWithHost: this.accountHandle }, | ||
91 | videoChannel: { nameWithHost: this.channelHandle } | ||
78 | } | 92 | } |
79 | 93 | ||
80 | this.videoService.getVideos(options) | 94 | if (this.channelHandle) return this.videoService.getVideoChannelVideos(options) |
81 | .pipe(finalize(() => this.loaded.emit(true))) | 95 | if (this.accountHandle) return this.videoService.getAccountVideos(options) |
82 | .subscribe( | ||
83 | ({ data }) => this.videos = data, | ||
84 | 96 | ||
85 | err => this.notifier.error('Error in videos list component: ' + err.message) | 97 | return this.videoService.getVideos(options) |
86 | ) | ||
87 | } | 98 | } |
88 | } | 99 | } |