diff options
Diffstat (limited to 'client/src/app/shared/shared-abuse-list')
3 files changed, 87 insertions, 86 deletions
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index a7932ebab..e3bf9e1fb 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts | |||
@@ -145,23 +145,24 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
145 | const res = await this.confirmService.confirm($localize`Do you really want to delete this abuse report?`, $localize`Delete`) | 145 | const res = await this.confirmService.confirm($localize`Do you really want to delete this abuse report?`, $localize`Delete`) |
146 | if (res === false) return | 146 | if (res === false) return |
147 | 147 | ||
148 | this.abuseService.removeAbuse(abuse).subscribe( | 148 | this.abuseService.removeAbuse(abuse) |
149 | () => { | 149 | .subscribe({ |
150 | this.notifier.success($localize`Abuse deleted.`) | 150 | next: () => { |
151 | this.reloadData() | 151 | this.notifier.success($localize`Abuse deleted.`) |
152 | }, | 152 | this.reloadData() |
153 | }, | ||
153 | 154 | ||
154 | err => this.notifier.error(err.message) | 155 | error: err => this.notifier.error(err.message) |
155 | ) | 156 | }) |
156 | } | 157 | } |
157 | 158 | ||
158 | updateAbuseState (abuse: AdminAbuse, state: AbuseState) { | 159 | updateAbuseState (abuse: AdminAbuse, state: AbuseState) { |
159 | this.abuseService.updateAbuse(abuse, { state }) | 160 | this.abuseService.updateAbuse(abuse, { state }) |
160 | .subscribe( | 161 | .subscribe({ |
161 | () => this.reloadData(), | 162 | next: () => this.reloadData(), |
162 | 163 | ||
163 | err => this.notifier.error(err.message) | 164 | error: err => this.notifier.error(err.message) |
164 | ) | 165 | }) |
165 | } | 166 | } |
166 | 167 | ||
167 | onCountMessagesUpdated (event: { abuseId: number, countMessages: number }) { | 168 | onCountMessagesUpdated (event: { abuseId: number, countMessages: number }) { |
@@ -198,55 +199,55 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
198 | ? this.abuseService.getAdminAbuses(options) | 199 | ? this.abuseService.getAdminAbuses(options) |
199 | : this.abuseService.getUserAbuses(options) | 200 | : this.abuseService.getUserAbuses(options) |
200 | 201 | ||
201 | return observable.subscribe( | 202 | return observable.subscribe({ |
202 | async resultList => { | 203 | next: async resultList => { |
203 | this.totalRecords = resultList.total | 204 | this.totalRecords = resultList.total |
204 | 205 | ||
205 | this.abuses = [] | 206 | this.abuses = [] |
206 | 207 | ||
207 | for (const a of resultList.data) { | 208 | for (const a of resultList.data) { |
208 | const abuse = a as ProcessedAbuse | 209 | const abuse = a as ProcessedAbuse |
209 | 210 | ||
210 | abuse.reasonHtml = await this.toHtml(abuse.reason) | 211 | abuse.reasonHtml = await this.toHtml(abuse.reason) |
211 | 212 | ||
212 | if (abuse.moderationComment) { | 213 | if (abuse.moderationComment) { |
213 | abuse.moderationCommentHtml = await this.toHtml(abuse.moderationComment) | 214 | abuse.moderationCommentHtml = await this.toHtml(abuse.moderationComment) |
214 | } | 215 | } |
215 | 216 | ||
216 | if (abuse.video) { | 217 | if (abuse.video) { |
217 | abuse.embedHtml = this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)) | 218 | abuse.embedHtml = this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)) |
218 | 219 | ||
219 | if (abuse.video.channel?.ownerAccount) { | 220 | if (abuse.video.channel?.ownerAccount) { |
220 | abuse.video.channel.ownerAccount = new Account(abuse.video.channel.ownerAccount) | 221 | abuse.video.channel.ownerAccount = new Account(abuse.video.channel.ownerAccount) |
221 | } | ||
222 | } | 222 | } |
223 | } | ||
223 | 224 | ||
224 | if (abuse.comment) { | 225 | if (abuse.comment) { |
225 | if (abuse.comment.deleted) { | 226 | if (abuse.comment.deleted) { |
226 | abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment` | 227 | abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment` |
227 | } else { | 228 | } else { |
228 | const truncated = truncate(abuse.comment.text, { length: 100 }) | 229 | const truncated = truncate(abuse.comment.text, { length: 100 }) |
229 | abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML(truncated, true) | 230 | abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML(truncated, true) |
230 | abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML(abuse.comment.text, true) | 231 | abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML(abuse.comment.text, true) |
231 | } | ||
232 | } | 232 | } |
233 | } | ||
233 | 234 | ||
234 | if (abuse.reporterAccount) { | 235 | if (abuse.reporterAccount) { |
235 | abuse.reporterAccount = new Account(abuse.reporterAccount) | 236 | abuse.reporterAccount = new Account(abuse.reporterAccount) |
236 | } | 237 | } |
237 | 238 | ||
238 | if (abuse.flaggedAccount) { | 239 | if (abuse.flaggedAccount) { |
239 | abuse.flaggedAccount = new Account(abuse.flaggedAccount) | 240 | abuse.flaggedAccount = new Account(abuse.flaggedAccount) |
240 | } | 241 | } |
241 | 242 | ||
242 | if (abuse.updatedAt === abuse.createdAt) delete abuse.updatedAt | 243 | if (abuse.updatedAt === abuse.createdAt) delete abuse.updatedAt |
243 | 244 | ||
244 | this.abuses.push(abuse) | 245 | this.abuses.push(abuse) |
245 | } | 246 | } |
246 | }, | 247 | }, |
247 | 248 | ||
248 | err => this.notifier.error(err.message) | 249 | error: err => this.notifier.error(err.message) |
249 | ) | 250 | }) |
250 | } | 251 | } |
251 | 252 | ||
252 | private buildInternalActions (): DropdownAction<ProcessedAbuse>[] { | 253 | private buildInternalActions (): DropdownAction<ProcessedAbuse>[] { |
@@ -351,15 +352,15 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
351 | isDisplayed: abuse => abuse.video && !abuse.video.deleted && !abuse.video.blacklisted, | 352 | isDisplayed: abuse => abuse.video && !abuse.video.deleted && !abuse.video.blacklisted, |
352 | handler: abuse => { | 353 | handler: abuse => { |
353 | this.videoBlocklistService.blockVideo(abuse.video.id, undefined, abuse.video.channel.isLocal) | 354 | this.videoBlocklistService.blockVideo(abuse.video.id, undefined, abuse.video.channel.isLocal) |
354 | .subscribe( | 355 | .subscribe({ |
355 | () => { | 356 | next: () => { |
356 | this.notifier.success($localize`Video blocked.`) | 357 | this.notifier.success($localize`Video blocked.`) |
357 | 358 | ||
358 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) | 359 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) |
359 | }, | 360 | }, |
360 | 361 | ||
361 | err => this.notifier.error(err.message) | 362 | error: err => this.notifier.error(err.message) |
362 | ) | 363 | }) |
363 | } | 364 | } |
364 | }, | 365 | }, |
365 | { | 366 | { |
@@ -367,15 +368,15 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
367 | isDisplayed: abuse => abuse.video && !abuse.video.deleted && abuse.video.blacklisted, | 368 | isDisplayed: abuse => abuse.video && !abuse.video.deleted && abuse.video.blacklisted, |
368 | handler: abuse => { | 369 | handler: abuse => { |
369 | this.videoBlocklistService.unblockVideo(abuse.video.id) | 370 | this.videoBlocklistService.unblockVideo(abuse.video.id) |
370 | .subscribe( | 371 | .subscribe({ |
371 | () => { | 372 | next: () => { |
372 | this.notifier.success($localize`Video unblocked.`) | 373 | this.notifier.success($localize`Video unblocked.`) |
373 | 374 | ||
374 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) | 375 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) |
375 | }, | 376 | }, |
376 | 377 | ||
377 | err => this.notifier.error(err.message) | 378 | error: err => this.notifier.error(err.message) |
378 | ) | 379 | }) |
379 | } | 380 | } |
380 | }, | 381 | }, |
381 | { | 382 | { |
@@ -389,15 +390,15 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
389 | if (res === false) return | 390 | if (res === false) return |
390 | 391 | ||
391 | this.videoService.removeVideo(abuse.video.id) | 392 | this.videoService.removeVideo(abuse.video.id) |
392 | .subscribe( | 393 | .subscribe({ |
393 | () => { | 394 | next: () => { |
394 | this.notifier.success($localize`Video deleted.`) | 395 | this.notifier.success($localize`Video deleted.`) |
395 | 396 | ||
396 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) | 397 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) |
397 | }, | 398 | }, |
398 | 399 | ||
399 | err => this.notifier.error(err.message) | 400 | error: err => this.notifier.error(err.message) |
400 | ) | 401 | }) |
401 | } | 402 | } |
402 | } | 403 | } |
403 | ] | 404 | ] |
@@ -424,15 +425,15 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
424 | if (res === false) return | 425 | if (res === false) return |
425 | 426 | ||
426 | this.commentService.deleteVideoComment(abuse.comment.video.id, abuse.comment.id) | 427 | this.commentService.deleteVideoComment(abuse.comment.video.id, abuse.comment.id) |
427 | .subscribe( | 428 | .subscribe({ |
428 | () => { | 429 | next: () => { |
429 | this.notifier.success($localize`Comment deleted.`) | 430 | this.notifier.success($localize`Comment deleted.`) |
430 | 431 | ||
431 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) | 432 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) |
432 | }, | 433 | }, |
433 | 434 | ||
434 | err => this.notifier.error(err.message) | 435 | error: err => this.notifier.error(err.message) |
435 | ) | 436 | }) |
436 | } | 437 | } |
437 | } | 438 | } |
438 | ] | 439 | ] |
@@ -440,25 +441,25 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
440 | 441 | ||
441 | private muteAccountHelper (account: Account) { | 442 | private muteAccountHelper (account: Account) { |
442 | this.blocklistService.blockAccountByInstance(account) | 443 | this.blocklistService.blockAccountByInstance(account) |
443 | .subscribe( | 444 | .subscribe({ |
444 | () => { | 445 | next: () => { |
445 | this.notifier.success($localize`Account ${account.nameWithHost} muted by the instance.`) | 446 | this.notifier.success($localize`Account ${account.nameWithHost} muted by the instance.`) |
446 | account.mutedByInstance = true | 447 | account.mutedByInstance = true |
447 | }, | 448 | }, |
448 | 449 | ||
449 | err => this.notifier.error(err.message) | 450 | error: err => this.notifier.error(err.message) |
450 | ) | 451 | }) |
451 | } | 452 | } |
452 | 453 | ||
453 | private muteServerHelper (host: string) { | 454 | private muteServerHelper (host: string) { |
454 | this.blocklistService.blockServerByInstance(host) | 455 | this.blocklistService.blockServerByInstance(host) |
455 | .subscribe( | 456 | .subscribe({ |
456 | () => { | 457 | next: () => { |
457 | this.notifier.success($localize`Server ${host} muted by the instance.`) | 458 | this.notifier.success($localize`Server ${host} muted by the instance.`) |
458 | }, | 459 | }, |
459 | 460 | ||
460 | err => this.notifier.error(err.message) | 461 | error: err => this.notifier.error(err.message) |
461 | ) | 462 | }) |
462 | } | 463 | } |
463 | 464 | ||
464 | private toHtml (text: string) { | 465 | private toHtml (text: string) { |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts index 9abb4c094..6c8dc6d35 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts | |||
@@ -61,8 +61,8 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit { | |||
61 | this.sendingMessage = true | 61 | this.sendingMessage = true |
62 | 62 | ||
63 | this.abuseService.addAbuseMessage(this.abuse, this.form.value['message']) | 63 | this.abuseService.addAbuseMessage(this.abuse, this.form.value['message']) |
64 | .subscribe( | 64 | .subscribe({ |
65 | () => { | 65 | next: () => { |
66 | this.form.reset() | 66 | this.form.reset() |
67 | this.sendingMessage = false | 67 | this.sendingMessage = false |
68 | this.countMessagesUpdated.emit({ abuseId: this.abuse.id, countMessages: this.abuseMessages.length + 1 }) | 68 | this.countMessagesUpdated.emit({ abuseId: this.abuse.id, countMessages: this.abuseMessages.length + 1 }) |
@@ -70,25 +70,25 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit { | |||
70 | this.loadMessages() | 70 | this.loadMessages() |
71 | }, | 71 | }, |
72 | 72 | ||
73 | err => { | 73 | error: err => { |
74 | this.sendingMessage = false | 74 | this.sendingMessage = false |
75 | console.error(err) | 75 | console.error(err) |
76 | this.notifier.error('Sorry but you cannot send this message. Please retry later') | 76 | this.notifier.error('Sorry but you cannot send this message. Please retry later') |
77 | } | 77 | } |
78 | ) | 78 | }) |
79 | } | 79 | } |
80 | 80 | ||
81 | deleteMessage (abuseMessage: AbuseMessage) { | 81 | deleteMessage (abuseMessage: AbuseMessage) { |
82 | this.abuseService.deleteAbuseMessage(this.abuse, abuseMessage) | 82 | this.abuseService.deleteAbuseMessage(this.abuse, abuseMessage) |
83 | .subscribe( | 83 | .subscribe({ |
84 | () => { | 84 | next: () => { |
85 | this.countMessagesUpdated.emit({ abuseId: this.abuse.id, countMessages: this.abuseMessages.length - 1 }) | 85 | this.countMessagesUpdated.emit({ abuseId: this.abuse.id, countMessages: this.abuseMessages.length - 1 }) |
86 | 86 | ||
87 | this.abuseMessages = this.abuseMessages.filter(m => m.id !== abuseMessage.id) | 87 | this.abuseMessages = this.abuseMessages.filter(m => m.id !== abuseMessage.id) |
88 | }, | 88 | }, |
89 | 89 | ||
90 | err => this.notifier.error(err.message) | 90 | error: err => this.notifier.error(err.message) |
91 | ) | 91 | }) |
92 | } | 92 | } |
93 | 93 | ||
94 | isMessageByMe (abuseMessage: AbuseMessage) { | 94 | isMessageByMe (abuseMessage: AbuseMessage) { |
@@ -105,8 +105,8 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit { | |||
105 | 105 | ||
106 | private loadMessages () { | 106 | private loadMessages () { |
107 | this.abuseService.listAbuseMessages(this.abuse) | 107 | this.abuseService.listAbuseMessages(this.abuse) |
108 | .subscribe( | 108 | .subscribe({ |
109 | async res => { | 109 | next: async res => { |
110 | this.abuseMessages = [] | 110 | this.abuseMessages = [] |
111 | 111 | ||
112 | for (const m of res.data) { | 112 | for (const m of res.data) { |
@@ -124,8 +124,8 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit { | |||
124 | }) | 124 | }) |
125 | }, | 125 | }, |
126 | 126 | ||
127 | err => this.notifier.error(err.message) | 127 | error: err => this.notifier.error(err.message) |
128 | ) | 128 | }) |
129 | } | 129 | } |
130 | 130 | ||
131 | } | 131 | } |
diff --git a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts index 876aeea8a..06f1555ea 100644 --- a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts +++ b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts | |||
@@ -53,16 +53,16 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI | |||
53 | const moderationComment: string = this.form.value[ 'moderationComment' ] | 53 | const moderationComment: string = this.form.value[ 'moderationComment' ] |
54 | 54 | ||
55 | this.abuseService.updateAbuse(this.abuseToComment, { moderationComment }) | 55 | this.abuseService.updateAbuse(this.abuseToComment, { moderationComment }) |
56 | .subscribe( | 56 | .subscribe({ |
57 | () => { | 57 | next: () => { |
58 | this.notifier.success($localize`Comment updated.`) | 58 | this.notifier.success($localize`Comment updated.`) |
59 | 59 | ||
60 | this.commentUpdated.emit(moderationComment) | 60 | this.commentUpdated.emit(moderationComment) |
61 | this.hide() | 61 | this.hide() |
62 | }, | 62 | }, |
63 | 63 | ||
64 | err => this.notifier.error(err.message) | 64 | error: err => this.notifier.error(err.message) |
65 | ) | 65 | }) |
66 | } | 66 | } |
67 | 67 | ||
68 | } | 68 | } |