import { DomSanitizer } from '@angular/platform-browser'
import { BlocklistService } from '@app/shared/blocklist'
import { VideoService } from '@app/shared/video/video.service'
+import { ActivatedRoute } from '@angular/router'
+import { first } from 'rxjs/operators'
@Component({
selector: 'my-video-abuse-list',
private confirmService: ConfirmService,
private i18n: I18n,
private markdownRenderer: MarkdownService,
- private sanitizer: DomSanitizer
+ private sanitizer: DomSanitizer,
+ private route: ActivatedRoute,
) {
super()
ngOnInit () {
this.initialize()
+
+ this.route.queryParams
+ .pipe(first(params => params.search !== undefined && params.search !== null))
+ .subscribe(params => this.search = params.search)
}
getIdentifier () {
}
protected loadData () {
- return this.videoAbuseService.getVideoAbuses(this.pagination, this.sort)
- .subscribe(
- async resultList => {
- this.totalRecords = resultList.total
-
- this.videoAbuses = resultList.data
-
- for (const abuse of this.videoAbuses) {
- Object.assign(abuse, {
- reasonHtml: await this.toHtml(abuse.reason),
- moderationCommentHtml: await this.toHtml(abuse.moderationComment),
- embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)),
- reporterAccount: new Account(abuse.reporterAccount)
- })
- }
-
- },
-
- err => this.notifier.error(err.message)
- )
+ return this.videoAbuseService.getVideoAbuses({
+ pagination: this.pagination,
+ sort: this.sort,
+ search: this.search
+ }).subscribe(
+ async resultList => {
+ this.totalRecords = resultList.total
+
+ this.videoAbuses = resultList.data
+
+ for (const abuse of this.videoAbuses) {
+ Object.assign(abuse, {
+ reasonHtml: await this.toHtml(abuse.reason),
+ moderationCommentHtml: await this.toHtml(abuse.moderationComment),
+ embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)),
+ reporterAccount: new Account(abuse.reporterAccount)
+ })
+ }
+
+ },
+
+ err => this.notifier.error(err.message)
+ )
}
private toHtml (text: string) {