X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-abuse-list%2Fmoderation-comment-modal.component.ts;h=4ad807d25371cc57898561f8326fe415eea0bc36;hb=HEAD;hp=ecb7966bfc636f784dedf7f93a109876a164d27a;hpb=94148c9028829b5576a5dcbfba2c7fb9cf6443d3;p=github%2FChocobozzz%2FPeerTube.git 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..4ad807d25 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,11 +1,11 @@ import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' import { Notifier } from '@app/core' -import { FormReactive, FormValidatorService, AbuseValidatorsService } from '@app/shared/shared-forms' +import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' import { AbuseService } from '@app/shared/shared-moderation' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { I18n } from '@ngx-translate/i18n-polyfill' import { AdminAbuse } from '@shared/models' +import { ABUSE_MODERATION_COMMENT_VALIDATOR } from '../form-validators/abuse-validators' @Component({ selector: 'my-moderation-comment-modal', @@ -20,19 +20,17 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI private openedModal: NgbModalRef constructor ( - protected formValidatorService: FormValidatorService, + protected formReactiveService: FormReactiveService, private modalService: NgbModal, private notifier: Notifier, - private abuseService: AbuseService, - private abuseValidatorsService: AbuseValidatorsService, - private i18n: I18n + private abuseService: AbuseService ) { super() } ngOnInit () { this.buildForm({ - moderationComment: this.abuseValidatorsService.ABUSE_MODERATION_COMMENT + moderationComment: ABUSE_MODERATION_COMMENT_VALIDATOR }) } @@ -51,20 +49,20 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI this.form.reset() } - async banUser () { - const moderationComment: string = this.form.value[ 'moderationComment' ] + banUser () { + const moderationComment: string = this.form.value['moderationComment'] this.abuseService.updateAbuse(this.abuseToComment, { moderationComment }) - .subscribe( - () => { - this.notifier.success(this.i18n('Comment updated.')) + .subscribe({ + next: () => { + this.notifier.success($localize`Comment updated.`) this.commentUpdated.emit(moderationComment) this.hide() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } }