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',
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
})
}
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)
+ })
}
}