diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-12 10:40:04 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-14 10:28:30 +0200 |
commit | 66357162f8e1227495f09bd4f68446aad7071c6d (patch) | |
tree | 7d4429506deb512b2fe1d0267f38a28cda20af55 /client/src/app/shared/shared-abuse-list | |
parent | 8c360747995e17eb5520e22fc3d7bd4c3d26eeee (diff) | |
download | PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.gz PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.zst PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.zip |
Migrate to $localize
* Remove i18n polyfill to translate things in components
* Reduce bundle sizes
* Improve runtime perf
* Reduce a lot the time to make a full client build
* Reduce client build complexity
* We don't need a service to translate things anymore (so we will be able to translate title pages etc)
Unfortunately we may loose some translations in the migration process.
I'll put a message on weblate to notify translators
Diffstat (limited to 'client/src/app/shared/shared-abuse-list')
4 files changed, 51 insertions, 65 deletions
diff --git a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts index 0e872079a..282a6fe19 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { durationToString } from '@app/helpers' | 2 | import { durationToString } from '@app/helpers' |
3 | import { Actor } from '@app/shared/shared-main' | 3 | import { Actor } from '@app/shared/shared-main' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
5 | import { AbusePredefinedReasonsString } from '@shared/models' | 4 | import { AbusePredefinedReasonsString } from '@shared/models' |
6 | import { ProcessedAbuse } from './processed-abuse.model' | 5 | import { ProcessedAbuse } from './processed-abuse.model' |
7 | 6 | ||
@@ -17,18 +16,16 @@ export class AbuseDetailsComponent { | |||
17 | 16 | ||
18 | private predefinedReasonsTranslations: { [key in AbusePredefinedReasonsString]: string } | 17 | private predefinedReasonsTranslations: { [key in AbusePredefinedReasonsString]: string } |
19 | 18 | ||
20 | constructor ( | 19 | constructor () { |
21 | private i18n: I18n | ||
22 | ) { | ||
23 | this.predefinedReasonsTranslations = { | 20 | this.predefinedReasonsTranslations = { |
24 | violentOrRepulsive: this.i18n('Violent or Repulsive'), | 21 | violentOrRepulsive: $localize`Violent or Repulsive`, |
25 | hatefulOrAbusive: this.i18n('Hateful or Abusive'), | 22 | hatefulOrAbusive: $localize`Hateful or Abusive`, |
26 | spamOrMisleading: this.i18n('Spam or Misleading'), | 23 | spamOrMisleading: $localize`Spam or Misleading`, |
27 | privacy: this.i18n('Privacy'), | 24 | privacy: $localize`Privacy`, |
28 | rights: this.i18n('Copyright'), | 25 | rights: $localize`Copyright`, |
29 | serverRules: this.i18n('Server rules'), | 26 | serverRules: $localize`Server rules`, |
30 | thumbnails: this.i18n('Thumbnails'), | 27 | thumbnails: $localize`Thumbnails`, |
31 | captions: this.i18n('Captions') | 28 | captions: $localize`Captions` |
32 | } | 29 | } |
33 | } | 30 | } |
34 | 31 | ||
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 c7dc5f4d2..cc933db0d 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 | |||
@@ -1,16 +1,15 @@ | |||
1 | import * as debug from 'debug' | 1 | import * as debug from 'debug' |
2 | import truncate from 'lodash-es/truncate' | 2 | import truncate from 'lodash-es/truncate' |
3 | import { SortMeta } from 'primeng/api' | 3 | import { SortMeta } from 'primeng/api' |
4 | import { buildVideoOrPlaylistEmbed, buildVideoLink } from 'src/assets/player/utils' | 4 | import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils' |
5 | import { environment } from 'src/environments/environment' | 5 | import { environment } from 'src/environments/environment' |
6 | import { AfterViewInit, Component, OnInit, ViewChild, Input } from '@angular/core' | 6 | import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core' |
7 | import { DomSanitizer } from '@angular/platform-browser' | 7 | import { DomSanitizer } from '@angular/platform-browser' |
8 | import { ActivatedRoute, Params, Router } from '@angular/router' | 8 | import { ActivatedRoute, Params, Router } from '@angular/router' |
9 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' | 9 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' |
10 | import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' | 10 | import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' |
11 | import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' | 11 | import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' |
12 | import { VideoCommentService } from '@app/shared/shared-video-comment' | 12 | import { VideoCommentService } from '@app/shared/shared-video-comment' |
13 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
14 | import { AbuseState, AdminAbuse } from '@shared/models' | 13 | import { AbuseState, AdminAbuse } from '@shared/models' |
15 | import { AbuseMessageModalComponent } from './abuse-message-modal.component' | 14 | import { AbuseMessageModalComponent } from './abuse-message-modal.component' |
16 | import { ModerationCommentModalComponent } from './moderation-comment-modal.component' | 15 | import { ModerationCommentModalComponent } from './moderation-comment-modal.component' |
@@ -45,7 +44,6 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
45 | private videoService: VideoService, | 44 | private videoService: VideoService, |
46 | private videoBlocklistService: VideoBlockService, | 45 | private videoBlocklistService: VideoBlockService, |
47 | private confirmService: ConfirmService, | 46 | private confirmService: ConfirmService, |
48 | private i18n: I18n, | ||
49 | private markdownRenderer: MarkdownService, | 47 | private markdownRenderer: MarkdownService, |
50 | private sanitizer: DomSanitizer, | 48 | private sanitizer: DomSanitizer, |
51 | private route: ActivatedRoute, | 49 | private route: ActivatedRoute, |
@@ -157,12 +155,12 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
157 | } | 155 | } |
158 | 156 | ||
159 | async removeAbuse (abuse: AdminAbuse) { | 157 | async removeAbuse (abuse: AdminAbuse) { |
160 | const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this abuse report?'), this.i18n('Delete')) | 158 | const res = await this.confirmService.confirm($localize`Do you really want to delete this abuse report?`, $localize`Delete`) |
161 | if (res === false) return | 159 | if (res === false) return |
162 | 160 | ||
163 | this.abuseService.removeAbuse(abuse).subscribe( | 161 | this.abuseService.removeAbuse(abuse).subscribe( |
164 | () => { | 162 | () => { |
165 | this.notifier.success(this.i18n('Abuse deleted.')) | 163 | this.notifier.success($localize`Abuse deleted.`) |
166 | this.loadData() | 164 | this.loadData() |
167 | }, | 165 | }, |
168 | 166 | ||
@@ -238,7 +236,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
238 | 236 | ||
239 | if (abuse.comment) { | 237 | if (abuse.comment) { |
240 | if (abuse.comment.deleted) { | 238 | if (abuse.comment.deleted) { |
241 | abuse.truncatedCommentHtml = abuse.commentHtml = this.i18n('Deleted comment') | 239 | abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment` |
242 | } else { | 240 | } else { |
243 | const truncated = truncate(abuse.comment.text, { length: 100 }) | 241 | const truncated = truncate(abuse.comment.text, { length: 100 }) |
244 | abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML(truncated, true) | 242 | abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML(truncated, true) |
@@ -267,38 +265,38 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
267 | private buildInternalActions (): DropdownAction<ProcessedAbuse>[] { | 265 | private buildInternalActions (): DropdownAction<ProcessedAbuse>[] { |
268 | return [ | 266 | return [ |
269 | { | 267 | { |
270 | label: this.i18n('Internal actions'), | 268 | label: $localize`Internal actions`, |
271 | isHeader: true | 269 | isHeader: true |
272 | }, | 270 | }, |
273 | { | 271 | { |
274 | label: this.isAdminView() | 272 | label: this.isAdminView() |
275 | ? this.i18n('Messages with reporter') | 273 | ? $localize`Messages with reporter` |
276 | : this.i18n('Messages with moderators'), | 274 | : $localize`Messages with moderators`, |
277 | handler: abuse => this.openAbuseMessagesModal(abuse), | 275 | handler: abuse => this.openAbuseMessagesModal(abuse), |
278 | isDisplayed: abuse => this.isLocalAbuse(abuse) | 276 | isDisplayed: abuse => this.isLocalAbuse(abuse) |
279 | }, | 277 | }, |
280 | { | 278 | { |
281 | label: this.i18n('Update internal note'), | 279 | label: $localize`Update internal note`, |
282 | handler: abuse => this.openModerationCommentModal(abuse), | 280 | handler: abuse => this.openModerationCommentModal(abuse), |
283 | isDisplayed: abuse => this.isAdminView() && !!abuse.moderationComment | 281 | isDisplayed: abuse => this.isAdminView() && !!abuse.moderationComment |
284 | }, | 282 | }, |
285 | { | 283 | { |
286 | label: this.i18n('Mark as accepted'), | 284 | label: $localize`Mark as accepted`, |
287 | handler: abuse => this.updateAbuseState(abuse, AbuseState.ACCEPTED), | 285 | handler: abuse => this.updateAbuseState(abuse, AbuseState.ACCEPTED), |
288 | isDisplayed: abuse => this.isAdminView() && !this.isAbuseAccepted(abuse) | 286 | isDisplayed: abuse => this.isAdminView() && !this.isAbuseAccepted(abuse) |
289 | }, | 287 | }, |
290 | { | 288 | { |
291 | label: this.i18n('Mark as rejected'), | 289 | label: $localize`Mark as rejected`, |
292 | handler: abuse => this.updateAbuseState(abuse, AbuseState.REJECTED), | 290 | handler: abuse => this.updateAbuseState(abuse, AbuseState.REJECTED), |
293 | isDisplayed: abuse => this.isAdminView() && !this.isAbuseRejected(abuse) | 291 | isDisplayed: abuse => this.isAdminView() && !this.isAbuseRejected(abuse) |
294 | }, | 292 | }, |
295 | { | 293 | { |
296 | label: this.i18n('Add internal note'), | 294 | label: $localize`Add internal note`, |
297 | handler: abuse => this.openModerationCommentModal(abuse), | 295 | handler: abuse => this.openModerationCommentModal(abuse), |
298 | isDisplayed: abuse => this.isAdminView() && !abuse.moderationComment | 296 | isDisplayed: abuse => this.isAdminView() && !abuse.moderationComment |
299 | }, | 297 | }, |
300 | { | 298 | { |
301 | label: this.i18n('Delete report'), | 299 | label: $localize`Delete report`, |
302 | handler: abuse => this.isAdminView() && this.removeAbuse(abuse) | 300 | handler: abuse => this.isAdminView() && this.removeAbuse(abuse) |
303 | } | 301 | } |
304 | ] | 302 | ] |
@@ -309,19 +307,19 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
309 | 307 | ||
310 | return [ | 308 | return [ |
311 | { | 309 | { |
312 | label: this.i18n('Actions for the flagged account'), | 310 | label: $localize`Actions for the flagged account`, |
313 | isHeader: true, | 311 | isHeader: true, |
314 | isDisplayed: abuse => abuse.flaggedAccount && !abuse.comment && !abuse.video | 312 | isDisplayed: abuse => abuse.flaggedAccount && !abuse.comment && !abuse.video |
315 | }, | 313 | }, |
316 | 314 | ||
317 | { | 315 | { |
318 | label: this.i18n('Mute account'), | 316 | label: $localize`Mute account`, |
319 | isDisplayed: abuse => abuse.flaggedAccount && !abuse.comment && !abuse.video, | 317 | isDisplayed: abuse => abuse.flaggedAccount && !abuse.comment && !abuse.video, |
320 | handler: abuse => this.muteAccountHelper(abuse.flaggedAccount) | 318 | handler: abuse => this.muteAccountHelper(abuse.flaggedAccount) |
321 | }, | 319 | }, |
322 | 320 | ||
323 | { | 321 | { |
324 | label: this.i18n('Mute server account'), | 322 | label: $localize`Mute server account`, |
325 | isDisplayed: abuse => abuse.flaggedAccount && !abuse.comment && !abuse.video, | 323 | isDisplayed: abuse => abuse.flaggedAccount && !abuse.comment && !abuse.video, |
326 | handler: abuse => this.muteServerHelper(abuse.flaggedAccount.host) | 324 | handler: abuse => this.muteServerHelper(abuse.flaggedAccount.host) |
327 | } | 325 | } |
@@ -333,19 +331,19 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
333 | 331 | ||
334 | return [ | 332 | return [ |
335 | { | 333 | { |
336 | label: this.i18n('Actions for the reporter'), | 334 | label: $localize`Actions for the reporter`, |
337 | isHeader: true, | 335 | isHeader: true, |
338 | isDisplayed: abuse => !!abuse.reporterAccount | 336 | isDisplayed: abuse => !!abuse.reporterAccount |
339 | }, | 337 | }, |
340 | 338 | ||
341 | { | 339 | { |
342 | label: this.i18n('Mute reporter'), | 340 | label: $localize`Mute reporter`, |
343 | isDisplayed: abuse => !!abuse.reporterAccount, | 341 | isDisplayed: abuse => !!abuse.reporterAccount, |
344 | handler: abuse => this.muteAccountHelper(abuse.reporterAccount) | 342 | handler: abuse => this.muteAccountHelper(abuse.reporterAccount) |
345 | }, | 343 | }, |
346 | 344 | ||
347 | { | 345 | { |
348 | label: this.i18n('Mute server'), | 346 | label: $localize`Mute server`, |
349 | isDisplayed: abuse => abuse.reporterAccount && !abuse.reporterAccount.userId, | 347 | isDisplayed: abuse => abuse.reporterAccount && !abuse.reporterAccount.userId, |
350 | handler: abuse => this.muteServerHelper(abuse.reporterAccount.host) | 348 | handler: abuse => this.muteServerHelper(abuse.reporterAccount.host) |
351 | } | 349 | } |
@@ -357,18 +355,18 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
357 | 355 | ||
358 | return [ | 356 | return [ |
359 | { | 357 | { |
360 | label: this.i18n('Actions for the video'), | 358 | label: $localize`Actions for the video`, |
361 | isHeader: true, | 359 | isHeader: true, |
362 | isDisplayed: abuse => abuse.video && !abuse.video.deleted | 360 | isDisplayed: abuse => abuse.video && !abuse.video.deleted |
363 | }, | 361 | }, |
364 | { | 362 | { |
365 | label: this.i18n('Block video'), | 363 | label: $localize`Block video`, |
366 | isDisplayed: abuse => abuse.video && !abuse.video.deleted && !abuse.video.blacklisted, | 364 | isDisplayed: abuse => abuse.video && !abuse.video.deleted && !abuse.video.blacklisted, |
367 | handler: abuse => { | 365 | handler: abuse => { |
368 | this.videoBlocklistService.blockVideo(abuse.video.id, undefined, true) | 366 | this.videoBlocklistService.blockVideo(abuse.video.id, undefined, true) |
369 | .subscribe( | 367 | .subscribe( |
370 | () => { | 368 | () => { |
371 | this.notifier.success(this.i18n('Video blocked.')) | 369 | this.notifier.success($localize`Video blocked.`) |
372 | 370 | ||
373 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) | 371 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) |
374 | }, | 372 | }, |
@@ -378,13 +376,13 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
378 | } | 376 | } |
379 | }, | 377 | }, |
380 | { | 378 | { |
381 | label: this.i18n('Unblock video'), | 379 | label: $localize`Unblock video`, |
382 | isDisplayed: abuse => abuse.video && !abuse.video.deleted && abuse.video.blacklisted, | 380 | isDisplayed: abuse => abuse.video && !abuse.video.deleted && abuse.video.blacklisted, |
383 | handler: abuse => { | 381 | handler: abuse => { |
384 | this.videoBlocklistService.unblockVideo(abuse.video.id) | 382 | this.videoBlocklistService.unblockVideo(abuse.video.id) |
385 | .subscribe( | 383 | .subscribe( |
386 | () => { | 384 | () => { |
387 | this.notifier.success(this.i18n('Video unblocked.')) | 385 | this.notifier.success($localize`Video unblocked.`) |
388 | 386 | ||
389 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) | 387 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) |
390 | }, | 388 | }, |
@@ -394,19 +392,19 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
394 | } | 392 | } |
395 | }, | 393 | }, |
396 | { | 394 | { |
397 | label: this.i18n('Delete video'), | 395 | label: $localize`Delete video`, |
398 | isDisplayed: abuse => abuse.video && !abuse.video.deleted, | 396 | isDisplayed: abuse => abuse.video && !abuse.video.deleted, |
399 | handler: async abuse => { | 397 | handler: async abuse => { |
400 | const res = await this.confirmService.confirm( | 398 | const res = await this.confirmService.confirm( |
401 | this.i18n('Do you really want to delete this video?'), | 399 | $localize`Do you really want to delete this video?`, |
402 | this.i18n('Delete') | 400 | $localize`Delete` |
403 | ) | 401 | ) |
404 | if (res === false) return | 402 | if (res === false) return |
405 | 403 | ||
406 | this.videoService.removeVideo(abuse.video.id) | 404 | this.videoService.removeVideo(abuse.video.id) |
407 | .subscribe( | 405 | .subscribe( |
408 | () => { | 406 | () => { |
409 | this.notifier.success(this.i18n('Video deleted.')) | 407 | this.notifier.success($localize`Video deleted.`) |
410 | 408 | ||
411 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) | 409 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) |
412 | }, | 410 | }, |
@@ -423,25 +421,25 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
423 | 421 | ||
424 | return [ | 422 | return [ |
425 | { | 423 | { |
426 | label: this.i18n('Actions for the comment'), | 424 | label: $localize`Actions for the comment`, |
427 | isHeader: true, | 425 | isHeader: true, |
428 | isDisplayed: abuse => abuse.comment && !abuse.comment.deleted | 426 | isDisplayed: abuse => abuse.comment && !abuse.comment.deleted |
429 | }, | 427 | }, |
430 | 428 | ||
431 | { | 429 | { |
432 | label: this.i18n('Delete comment'), | 430 | label: $localize`Delete comment`, |
433 | isDisplayed: abuse => abuse.comment && !abuse.comment.deleted, | 431 | isDisplayed: abuse => abuse.comment && !abuse.comment.deleted, |
434 | handler: async abuse => { | 432 | handler: async abuse => { |
435 | const res = await this.confirmService.confirm( | 433 | const res = await this.confirmService.confirm( |
436 | this.i18n('Do you really want to delete this comment?'), | 434 | $localize`Do you really want to delete this comment?`, |
437 | this.i18n('Delete') | 435 | $localize`Delete` |
438 | ) | 436 | ) |
439 | if (res === false) return | 437 | if (res === false) return |
440 | 438 | ||
441 | this.commentService.deleteVideoComment(abuse.comment.video.id, abuse.comment.id) | 439 | this.commentService.deleteVideoComment(abuse.comment.video.id, abuse.comment.id) |
442 | .subscribe( | 440 | .subscribe( |
443 | () => { | 441 | () => { |
444 | this.notifier.success(this.i18n('Comment deleted.')) | 442 | this.notifier.success($localize`Comment deleted.`) |
445 | 443 | ||
446 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) | 444 | this.updateAbuseState(abuse, AbuseState.ACCEPTED) |
447 | }, | 445 | }, |
@@ -457,10 +455,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
457 | this.blocklistService.blockAccountByInstance(account) | 455 | this.blocklistService.blockAccountByInstance(account) |
458 | .subscribe( | 456 | .subscribe( |
459 | () => { | 457 | () => { |
460 | this.notifier.success( | 458 | this.notifier.success($localize`Account ${account.nameWithHost} muted by the instance.`) |
461 | this.i18n('Account {{nameWithHost}} muted by the instance.', { nameWithHost: account.nameWithHost }) | ||
462 | ) | ||
463 | |||
464 | account.mutedByInstance = true | 459 | account.mutedByInstance = true |
465 | }, | 460 | }, |
466 | 461 | ||
@@ -472,9 +467,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
472 | this.blocklistService.blockServerByInstance(host) | 467 | this.blocklistService.blockServerByInstance(host) |
473 | .subscribe( | 468 | .subscribe( |
474 | () => { | 469 | () => { |
475 | this.notifier.success( | 470 | this.notifier.success($localize`Server ${host} muted by the instance.`) |
476 | this.i18n('Server {{host}} muted by the instance.', { host: host }) | ||
477 | ) | ||
478 | }, | 471 | }, |
479 | 472 | ||
480 | err => this.notifier.error(err.message) | 473 | err => this.notifier.error(err.message) |
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 6686d91f4..0c3c8ff48 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 | |||
@@ -1,9 +1,8 @@ | |||
1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { AuthService, Notifier, HtmlRendererService } from '@app/core' | 2 | import { AuthService, HtmlRendererService, Notifier } from '@app/core' |
3 | import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 3 | import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
5 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 5 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | import { AbuseMessage, UserAbuse } from '@shared/models' | 6 | import { AbuseMessage, UserAbuse } from '@shared/models' |
8 | import { AbuseService } from '../shared-moderation' | 7 | import { AbuseService } from '../shared-moderation' |
9 | 8 | ||
@@ -31,7 +30,6 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit { | |||
31 | protected formValidatorService: FormValidatorService, | 30 | protected formValidatorService: FormValidatorService, |
32 | private abuseValidatorsService: AbuseValidatorsService, | 31 | private abuseValidatorsService: AbuseValidatorsService, |
33 | private modalService: NgbModal, | 32 | private modalService: NgbModal, |
34 | private i18n: I18n, | ||
35 | private htmlRenderer: HtmlRendererService, | 33 | private htmlRenderer: HtmlRendererService, |
36 | private auth: AuthService, | 34 | private auth: AuthService, |
37 | private notifier: Notifier, | 35 | private notifier: Notifier, |
@@ -99,10 +97,10 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit { | |||
99 | 97 | ||
100 | getPlaceholderMessage () { | 98 | getPlaceholderMessage () { |
101 | if (this.isAdminView) { | 99 | if (this.isAdminView) { |
102 | return this.i18n('Add a message to communicate with the reporter') | 100 | return $localize`Add a message to communicate with the reporter` |
103 | } | 101 | } |
104 | 102 | ||
105 | return this.i18n('Add a message to communicate with the moderation team') | 103 | return $localize`Add a message to communicate with the moderation team` |
106 | } | 104 | } |
107 | 105 | ||
108 | private loadMessages () { | 106 | private loadMessages () { |
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 ecb7966bf..fad7f888d 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 | |||
@@ -1,10 +1,9 @@ | |||
1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Notifier } from '@app/core' | 2 | import { Notifier } from '@app/core' |
3 | import { FormReactive, FormValidatorService, AbuseValidatorsService } from '@app/shared/shared-forms' | 3 | import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
4 | import { AbuseService } from '@app/shared/shared-moderation' | 4 | import { AbuseService } from '@app/shared/shared-moderation' |
5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
6 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 6 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | import { AdminAbuse } from '@shared/models' | 7 | import { AdminAbuse } from '@shared/models' |
9 | 8 | ||
10 | @Component({ | 9 | @Component({ |
@@ -24,8 +23,7 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI | |||
24 | private modalService: NgbModal, | 23 | private modalService: NgbModal, |
25 | private notifier: Notifier, | 24 | private notifier: Notifier, |
26 | private abuseService: AbuseService, | 25 | private abuseService: AbuseService, |
27 | private abuseValidatorsService: AbuseValidatorsService, | 26 | private abuseValidatorsService: AbuseValidatorsService |
28 | private i18n: I18n | ||
29 | ) { | 27 | ) { |
30 | super() | 28 | super() |
31 | } | 29 | } |
@@ -57,7 +55,7 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI | |||
57 | this.abuseService.updateAbuse(this.abuseToComment, { moderationComment }) | 55 | this.abuseService.updateAbuse(this.abuseToComment, { moderationComment }) |
58 | .subscribe( | 56 | .subscribe( |
59 | () => { | 57 | () => { |
60 | this.notifier.success(this.i18n('Comment updated.')) | 58 | this.notifier.success($localize`Comment updated.`) |
61 | 59 | ||
62 | this.commentUpdated.emit(moderationComment) | 60 | this.commentUpdated.emit(moderationComment) |
63 | this.hide() | 61 | this.hide() |