Support accountHandle and channelHandle
This commit is contained in:
parent
8b61dcaf23
commit
674d903b0e
|
@ -188,6 +188,9 @@ export class CustomMarkupService {
|
||||||
categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [],
|
categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [],
|
||||||
languageOneOf: this.buildArrayString(data.languageOneOf) ?? [],
|
languageOneOf: this.buildArrayString(data.languageOneOf) ?? [],
|
||||||
|
|
||||||
|
accountHandle: data.accountHandle || undefined,
|
||||||
|
channelHandle: data.channelHandle || undefined,
|
||||||
|
|
||||||
filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined
|
filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
|
||||||
@Input() onlyDisplayTitle: boolean
|
@Input() onlyDisplayTitle: boolean
|
||||||
@Input() filter: VideoFilter
|
@Input() filter: VideoFilter
|
||||||
@Input() maxRows: number
|
@Input() maxRows: number
|
||||||
|
@Input() channelHandle: string
|
||||||
|
@Input() accountHandle: string
|
||||||
|
|
||||||
@Output() loaded = new EventEmitter<boolean>()
|
@Output() loaded = new EventEmitter<boolean>()
|
||||||
|
|
||||||
|
@ -66,6 +68,16 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this.getVideosObservable()
|
||||||
|
.pipe(finalize(() => this.loaded.emit(true)))
|
||||||
|
.subscribe(
|
||||||
|
({ data }) => this.videos = data,
|
||||||
|
|
||||||
|
err => this.notifier.error('Error in videos list component: ' + err.message)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
getVideosObservable () {
|
||||||
const options = {
|
const options = {
|
||||||
videoPagination: {
|
videoPagination: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
|
@ -74,15 +86,14 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
|
||||||
categoryOneOf: this.categoryOneOf,
|
categoryOneOf: this.categoryOneOf,
|
||||||
languageOneOf: this.languageOneOf,
|
languageOneOf: this.languageOneOf,
|
||||||
filter: this.filter,
|
filter: this.filter,
|
||||||
sort: this.sort as VideoSortField
|
sort: this.sort as VideoSortField,
|
||||||
|
account: { nameWithHost: this.accountHandle },
|
||||||
|
videoChannel: { nameWithHost: this.channelHandle }
|
||||||
}
|
}
|
||||||
|
|
||||||
this.videoService.getVideos(options)
|
if (this.channelHandle) return this.videoService.getVideoChannelVideos(options)
|
||||||
.pipe(finalize(() => this.loaded.emit(true)))
|
if (this.accountHandle) return this.videoService.getAccountVideos(options)
|
||||||
.subscribe(
|
|
||||||
({ data }) => this.videos = data,
|
|
||||||
|
|
||||||
err => this.notifier.error('Error in videos list component: ' + err.message)
|
return this.videoService.getVideos(options)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ export class VideoService implements VideosProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccountVideos (parameters: {
|
getAccountVideos (parameters: {
|
||||||
account: Account,
|
account: Pick<Account, 'nameWithHost'>,
|
||||||
videoPagination: ComponentPaginationLight,
|
videoPagination: ComponentPaginationLight,
|
||||||
sort: VideoSortField
|
sort: VideoSortField
|
||||||
nsfwPolicy?: NSFWPolicyType
|
nsfwPolicy?: NSFWPolicyType
|
||||||
|
@ -180,7 +180,7 @@ export class VideoService implements VideosProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
getVideoChannelVideos (parameters: {
|
getVideoChannelVideos (parameters: {
|
||||||
videoChannel: VideoChannel,
|
videoChannel: Pick<VideoChannel, 'nameWithHost'>,
|
||||||
videoPagination: ComponentPaginationLight,
|
videoPagination: ComponentPaginationLight,
|
||||||
sort: VideoSortField,
|
sort: VideoSortField,
|
||||||
nsfwPolicy?: NSFWPolicyType
|
nsfwPolicy?: NSFWPolicyType
|
||||||
|
|
|
@ -30,9 +30,12 @@ export type VideosListMarkupData = {
|
||||||
sort?: string
|
sort?: string
|
||||||
count?: string // number
|
count?: string // number
|
||||||
|
|
||||||
categoryOneOf?: string // coma separated values
|
categoryOneOf?: string // coma separated values, number[]
|
||||||
languageOneOf?: string // coma separated values
|
languageOneOf?: string // coma separated values
|
||||||
|
|
||||||
|
channelHandle?: string
|
||||||
|
accountHandle?: string
|
||||||
|
|
||||||
onlyLocal?: string // boolean
|
onlyLocal?: string // boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user