import { AfterViewInit, Component, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { AuthService, ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core'
+import { AdvancedInputFilter } from '@app/shared/shared-forms'
import { DropdownAction } from '@app/shared/shared-main'
import { BulkService } from '@app/shared/shared-moderation'
import { VideoCommentAdmin, VideoCommentService } from '@app/shared/shared-video-comment'
templateUrl: './video-comment-list.component.html',
styleUrls: [ '../../../shared/shared-moderation/moderation.scss', './video-comment-list.component.scss' ]
})
-export class VideoCommentListComponent extends RestTable implements OnInit, AfterViewInit {
- baseRoute = '/admin/moderation/video-comments/list'
-
+export class VideoCommentListComponent extends RestTable implements OnInit {
comments: VideoCommentAdmin[]
totalRecords = 0
sort: SortMeta = { field: 'createdAt', order: -1 }
selectedComments: VideoCommentAdmin[] = []
bulkCommentActions: DropdownAction<VideoCommentAdmin[]>[] = []
+ inputFilters: AdvancedInputFilter[] = [
+ {
+ queryParams: { 'search': 'local:true' },
+ label: $localize`Local comments`
+ },
+ {
+ queryParams: { 'search': 'local:false' },
+ label: $localize`Remote comments`
+ }
+ ]
+
get authUser () {
return this.auth.getUser()
}
ngOnInit () {
this.initialize()
- this.listenToSearchChange()
this.bulkCommentActions = [
{
]
}
- ngAfterViewInit () {
- if (this.search) this.setTableFilter(this.search, false)
- }
-
getIdentifier () {
return 'VideoCommentListComponent'
}
return this.selectedComments.length !== 0
}
- protected loadData () {
+ protected reloadData () {
this.videoCommentService.getAdminVideoComments({
pagination: this.pagination,
sort: this.sort,
this.videoCommentService.deleteVideoComments(commentArgs).subscribe(
() => {
this.notifier.success($localize`${commentArgs.length} comments deleted.`)
- this.loadData()
+ this.reloadData()
},
err => this.notifier.error(err.message),
private deleteComment (comment: VideoCommentAdmin) {
this.videoCommentService.deleteVideoComment(comment.video.id, comment.id)
.subscribe(
- () => this.loadData(),
+ () => this.reloadData(),
err => this.notifier.error(err.message)
)