X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-abuse-list%2Fabuse-list-table.component.ts;h=d8470e927768e9054099987b18287c1a42ffee54;hb=HEAD;hp=8781c16f5c3d99ca763370cd4e7d213e71e99b56;hpb=82b9a1005cd5f5d3c338270839a24f217594b35d;p=github%2FChocobozzz%2FPeerTube.git 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 8781c16f5..d8470e927 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 @@ -2,19 +2,19 @@ import * as debug from 'debug' import truncate from 'lodash-es/truncate' import { SortMeta } from 'primeng/api' import { Component, Input, OnInit, ViewChild } from '@angular/core' -import { DomSanitizer } from '@angular/platform-browser' import { ActivatedRoute, Router } from '@angular/router' import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' import { VideoCommentService } from '@app/shared/shared-video-comment' +import { logger } from '@root-helpers/logger' import { AbuseState, AdminAbuse } from '@shared/models' import { AdvancedInputFilter } from '../shared-forms' import { AbuseMessageModalComponent } from './abuse-message-modal.component' import { ModerationCommentModalComponent } from './moderation-comment-modal.component' import { ProcessedAbuse } from './processed-abuse.model' -const logger = debug('peertube:moderation:AbuseListTableComponent') +const debugLogger = debug('peertube:moderation:AbuseListTableComponent') @Component({ selector: 'my-abuse-list-table', @@ -72,8 +72,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit { private videoService: VideoService, private videoBlocklistService: VideoBlockService, private confirmService: ConfirmService, - private markdownRenderer: MarkdownService, - private sanitizer: DomSanitizer + private markdownRenderer: MarkdownService ) { super() } @@ -158,7 +157,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit { const abuse = this.abuses.find(a => a.id === event.abuseId) if (!abuse) { - console.error('Cannot find abuse %d.', event.abuseId) + logger.error(`Cannot find abuse ${event.abuseId}`) return } @@ -176,8 +175,8 @@ export class AbuseListTableComponent extends RestTable implements OnInit { return Actor.IS_LOCAL(abuse.reporterAccount.host) } - protected reloadData () { - logger('Loading data.') + protected reloadDataInternal () { + debugLogger('Loading data.') const options = { pagination: this.pagination, @@ -215,8 +214,8 @@ export class AbuseListTableComponent extends RestTable implements OnInit { abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment` } else { const truncated = truncate(abuse.comment.text, { length: 100 }) - abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML(truncated, true) - abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML(abuse.comment.text, true) + abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML({ markdown: truncated, withHtml: true }) + abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML({ markdown: abuse.comment.text, withHtml: true }) } } @@ -273,7 +272,8 @@ export class AbuseListTableComponent extends RestTable implements OnInit { }, { label: $localize`Delete report`, - handler: abuse => this.isAdminView() && this.removeAbuse(abuse) + handler: abuse => this.removeAbuse(abuse), + isDisplayed: () => this.isAdminView() } ] } @@ -451,6 +451,6 @@ export class AbuseListTableComponent extends RestTable implements OnInit { } private toHtml (text: string) { - return this.markdownRenderer.textMarkdownToHTML(text) + return this.markdownRenderer.textMarkdownToHTML({ markdown: text }) } }