X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Fmoderation%2Fvideo-comment-list%2Fvideo-comment-list.component.ts;h=e2ae993b0598fa02e8c7a804acf811b5a9d8a0d4;hb=c7027c06e9a73dad99d3f9bd9937a41a763850ce;hp=529e28f1168b9d17379d88dbd5def5a5ca79f851;hpb=939917705fa3fa93ab7036b5e7e9aaf5f1d0023e;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts index 529e28f11..e2ae993b0 100644 --- a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts +++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts @@ -2,6 +2,7 @@ import { SortMeta } from 'primeng/api' 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' @@ -12,9 +13,7 @@ import { FeedFormat, UserRight } from '@shared/models' 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 } @@ -43,6 +42,17 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte selectedComments: VideoCommentAdmin[] = [] bulkCommentActions: DropdownAction[] = [] + inputFilters: AdvancedInputFilter[] = [ + { + queryParams: { 'search': 'local:true' }, + label: $localize`Local comments` + }, + { + queryParams: { 'search': 'local:false' }, + label: $localize`Remote comments` + } + ] + get authUser () { return this.auth.getUser() } @@ -79,7 +89,6 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte ngOnInit () { this.initialize() - this.listenToSearchChange() this.bulkCommentActions = [ { @@ -91,10 +100,6 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte ] } - ngAfterViewInit () { - if (this.search) this.setTableFilter(this.search) - } - getIdentifier () { return 'VideoCommentListComponent' } @@ -107,7 +112,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte return this.selectedComments.length !== 0 } - protected loadData () { + protected reloadData () { this.videoCommentService.getAdminVideoComments({ pagination: this.pagination, sort: this.sort, @@ -135,7 +140,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte this.videoCommentService.deleteVideoComments(commentArgs).subscribe( () => { this.notifier.success($localize`${commentArgs.length} comments deleted.`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message), @@ -147,7 +152,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte private deleteComment (comment: VideoCommentAdmin) { this.videoCommentService.deleteVideoComment(comment.video.id, comment.id) .subscribe( - () => this.loadData(), + () => this.reloadData(), err => this.notifier.error(err.message) )