diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts index 8562e564b..89a04c078 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts @@ -42,7 +42,9 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { newFollow: this.i18n('You or your channel(s) has a new follower'), commentMention: this.i18n('Someone mentioned you in video comments'), newInstanceFollower: this.i18n('Your instance has a new follower'), - autoInstanceFollowing: this.i18n('Your instance auto followed another instance') + autoInstanceFollowing: this.i18n('Your instance auto followed another instance'), + abuseNewMessage: this.i18n('An abuse received a new message'), + abuseStateChange: this.i18n('One of your abuse has been accepted or rejected by moderators') } this.notificationSettingKeys = Object.keys(this.labelNotifications) as (keyof UserNotificationSetting)[] diff --git a/client/src/app/core/renderer/html-renderer.service.ts b/client/src/app/core/renderer/html-renderer.service.ts index f0527c759..302d92ed9 100644 --- a/client/src/app/core/renderer/html-renderer.service.ts +++ b/client/src/app/core/renderer/html-renderer.service.ts @@ -3,19 +3,29 @@ import { LinkifierService } from './linkifier.service' @Injectable() export class HtmlRendererService { + private sanitizeHtml: typeof import ('sanitize-html') constructor (private linkifier: LinkifierService) { } + async convertToBr (text: string) { + await this.loadSanitizeHtml() + + const html = text.replace(/\r?\n/g, '
') + + return this.sanitizeHtml(html, { + allowedTags: [ 'br' ] + }) + } + async toSafeHtml (text: string) { - // FIXME: import('..') returns a struct module, containing a "default" field corresponding to our sanitizeHtml function - const sanitizeHtml: typeof import ('sanitize-html') = (await import('sanitize-html') as any).default + await this.loadSanitizeHtml() // Convert possible markdown to html const html = this.linkifier.linkify(text) - return sanitizeHtml(html, { + return this.sanitizeHtml(html, { allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ], allowedSchemes: [ 'http', 'https' ], allowedAttributes: { @@ -37,4 +47,9 @@ export class HtmlRendererService { } }) } + + private async loadSanitizeHtml () { + // FIXME: import('..') returns a struct module, containing a "default" field corresponding to our sanitizeHtml function + this.sanitizeHtml = (await import('sanitize-html') as any).default + } } diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html index 17b3742d6..d90b93fff 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html @@ -42,6 +42,7 @@ Created State Messages + Internal note @@ -144,13 +145,11 @@ - {{ abuse.createdAt | date: 'short' }} - @@ -161,6 +160,10 @@ + + {{ abuse.moderationComment }} + + this.isLocalAbuse(abuse) }, { - label: this.i18n('Update note'), + label: this.i18n('Update internal note'), handler: abuse => this.openModerationCommentModal(abuse), isDisplayed: abuse => this.isAdminView() && !!abuse.moderationComment }, diff --git a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.html b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.html index cb965b71d..17e9ce4cf 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.html +++ b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.html @@ -9,7 +9,7 @@