aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts')
-rw-r--r--client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts59
1 files changed, 30 insertions, 29 deletions
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 e2ae993b0..4904bcc25 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
@@ -1,5 +1,5 @@
1import { SortMeta } from 'primeng/api' 1import { SortMeta } from 'primeng/api'
2import { AfterViewInit, Component, OnInit } from '@angular/core' 2import { Component, OnInit } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { AuthService, ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' 4import { AuthService, ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core'
5import { AdvancedInputFilter } from '@app/shared/shared-forms' 5import { AdvancedInputFilter } from '@app/shared/shared-forms'
@@ -117,45 +117,46 @@ export class VideoCommentListComponent extends RestTable implements OnInit {
117 pagination: this.pagination, 117 pagination: this.pagination,
118 sort: this.sort, 118 sort: this.sort,
119 search: this.search 119 search: this.search
120 }).subscribe( 120 }).subscribe({
121 async resultList => { 121 next: async resultList => {
122 this.totalRecords = resultList.total 122 this.totalRecords = resultList.total
123 123
124 this.comments = [] 124 this.comments = []
125 125
126 for (const c of resultList.data) { 126 for (const c of resultList.data) {
127 this.comments.push( 127 this.comments.push(
128 new VideoCommentAdmin(c, await this.toHtml(c.text)) 128 new VideoCommentAdmin(c, await this.toHtml(c.text))
129 ) 129 )
130 } 130 }
131 }, 131 },
132 132
133 err => this.notifier.error(err.message) 133 error: err => this.notifier.error(err.message)
134 ) 134 })
135 } 135 }
136 136
137 private async removeComments (comments: VideoCommentAdmin[]) { 137 private async removeComments (comments: VideoCommentAdmin[]) {
138 const commentArgs = comments.map(c => ({ videoId: c.video.id, commentId: c.id })) 138 const commentArgs = comments.map(c => ({ videoId: c.video.id, commentId: c.id }))
139 139
140 this.videoCommentService.deleteVideoComments(commentArgs).subscribe( 140 this.videoCommentService.deleteVideoComments(commentArgs)
141 () => { 141 .subscribe({
142 this.notifier.success($localize`${commentArgs.length} comments deleted.`) 142 next: () => {
143 this.reloadData() 143 this.notifier.success($localize`${commentArgs.length} comments deleted.`)
144 }, 144 this.reloadData()
145 },
145 146
146 err => this.notifier.error(err.message), 147 error: err => this.notifier.error(err.message),
147 148
148 () => this.selectedComments = [] 149 complete: () => this.selectedComments = []
149 ) 150 })
150 } 151 }
151 152
152 private deleteComment (comment: VideoCommentAdmin) { 153 private deleteComment (comment: VideoCommentAdmin) {
153 this.videoCommentService.deleteVideoComment(comment.video.id, comment.id) 154 this.videoCommentService.deleteVideoComment(comment.video.id, comment.id)
154 .subscribe( 155 .subscribe({
155 () => this.reloadData(), 156 next: () => this.reloadData(),
156 157
157 err => this.notifier.error(err.message) 158 error: err => this.notifier.error(err.message)
158 ) 159 })
159 } 160 }
160 161
161 private async deleteUserComments (comment: VideoCommentAdmin) { 162 private async deleteUserComments (comment: VideoCommentAdmin) {
@@ -169,12 +170,12 @@ export class VideoCommentListComponent extends RestTable implements OnInit {
169 } 170 }
170 171
171 this.bulkService.removeCommentsOf(options) 172 this.bulkService.removeCommentsOf(options)
172 .subscribe( 173 .subscribe({
173 () => { 174 next: () => {
174 this.notifier.success($localize`Comments of ${options.accountName} will be deleted in a few minutes`) 175 this.notifier.success($localize`Comments of ${options.accountName} will be deleted in a few minutes`)
175 }, 176 },
176 177
177 err => this.notifier.error(err.message) 178 error: err => this.notifier.error(err.message)
178 ) 179 })
179 } 180 }
180} 181}