import { SortMeta } from 'primeng/api'
-import { AfterViewInit, Component, OnInit } from '@angular/core'
+import { 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'
inputFilters: AdvancedInputFilter[] = [
{
- queryParams: { 'search': 'local:true' },
- label: $localize`Local comments`
- },
- {
- queryParams: { 'search': 'local:false' },
- label: $localize`Remote comments`
+ title: $localize`Advanced filters`,
+ children: [
+ {
+ value: 'local:true',
+ label: $localize`Local comments`
+ },
+ {
+ value: 'local:false',
+ label: $localize`Remote comments`
+ }
+ ]
}
]
private videoCommentService: VideoCommentService,
private markdownRenderer: MarkdownService,
private bulkService: BulkService
- ) {
+ ) {
super()
this.videoCommentActions = [
pagination: this.pagination,
sort: this.sort,
search: this.search
- }).subscribe(
- async resultList => {
- this.totalRecords = resultList.total
+ }).subscribe({
+ next: async resultList => {
+ this.totalRecords = resultList.total
- this.comments = []
+ this.comments = []
- for (const c of resultList.data) {
- this.comments.push(
- new VideoCommentAdmin(c, await this.toHtml(c.text))
- )
- }
- },
+ for (const c of resultList.data) {
+ this.comments.push(
+ new VideoCommentAdmin(c, await this.toHtml(c.text))
+ )
+ }
+ },
- err => this.notifier.error(err.message)
- )
+ error: err => this.notifier.error(err.message)
+ })
}
- private async removeComments (comments: VideoCommentAdmin[]) {
+ private removeComments (comments: VideoCommentAdmin[]) {
const commentArgs = comments.map(c => ({ videoId: c.video.id, commentId: c.id }))
- this.videoCommentService.deleteVideoComments(commentArgs).subscribe(
- () => {
- this.notifier.success($localize`${commentArgs.length} comments deleted.`)
- this.reloadData()
- },
+ this.videoCommentService.deleteVideoComments(commentArgs)
+ .subscribe({
+ next: () => {
+ this.notifier.success($localize`${commentArgs.length} comments deleted.`)
+ this.reloadData()
+ },
- err => this.notifier.error(err.message),
+ error: err => this.notifier.error(err.message),
- () => this.selectedComments = []
- )
+ complete: () => this.selectedComments = []
+ })
}
private deleteComment (comment: VideoCommentAdmin) {
this.videoCommentService.deleteVideoComment(comment.video.id, comment.id)
- .subscribe(
- () => this.reloadData(),
+ .subscribe({
+ next: () => this.reloadData(),
- err => this.notifier.error(err.message)
- )
+ error: err => this.notifier.error(err.message)
+ })
}
private async deleteUserComments (comment: VideoCommentAdmin) {
}
this.bulkService.removeCommentsOf(options)
- .subscribe(
- () => {
+ .subscribe({
+ next: () => {
this.notifier.success($localize`Comments of ${options.accountName} will be deleted in a few minutes`)
},
- err => this.notifier.error(err.message)
- )
+ error: err => this.notifier.error(err.message)
+ })
}
}