diff options
Diffstat (limited to 'client/src/app/+admin/moderation/video-comment-list')
-rw-r--r-- | client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html | 8 | ||||
-rw-r--r-- | client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts | 59 |
2 files changed, 34 insertions, 33 deletions
diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html index 9d9283536..0fd0588ba 100644 --- a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html +++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html | |||
@@ -34,13 +34,13 @@ | |||
34 | 34 | ||
35 | <ng-template pTemplate="header"> | 35 | <ng-template pTemplate="header"> |
36 | <tr> | 36 | <tr> |
37 | <th style="width: 40px"> | 37 | <th style="width: 40px;"> |
38 | <p-tableHeaderCheckbox ariaLabel="Select all rows" i18n-ariaLabel></p-tableHeaderCheckbox> | 38 | <p-tableHeaderCheckbox ariaLabel="Select all rows" i18n-ariaLabel></p-tableHeaderCheckbox> |
39 | </th> | 39 | </th> |
40 | <th style="width: 40px"></th> | 40 | <th style="width: 40px;"></th> |
41 | <th style="width: 150px;"></th> | 41 | <th style="width: 150px;"></th> |
42 | <th style="width: 300px" i18n>Account</th> | 42 | <th style="width: 300px;" i18n>Account</th> |
43 | <th style="width: 300px" i18n>Video</th> | 43 | <th style="width: 300px;" i18n>Video</th> |
44 | <th i18n>Comment</th> | 44 | <th i18n>Comment</th> |
45 | <th style="width: 150px;" i18n pSortableColumn="createdAt">Date <p-sortIcon field="createdAt"></p-sortIcon></th> | 45 | <th style="width: 150px;" i18n pSortableColumn="createdAt">Date <p-sortIcon field="createdAt"></p-sortIcon></th> |
46 | </tr> | 46 | </tr> |
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 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { AfterViewInit, Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { AuthService, ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' | 4 | import { AuthService, ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' |
5 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | 5 | import { 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 | } |