1
0
Fork 0

Fix report modal error

This commit is contained in:
Chocobozzz 2021-12-07 11:05:45 +01:00
parent 5bd427e01c
commit ae9809a7d0
No known key found for this signature in database
GPG key ID: 583A612D890159BE
3 changed files with 9 additions and 8 deletions

View file

@ -85,5 +85,5 @@
</div>
<ng-container *ngIf="prependModerationActions">
<my-account-report #accountReportModal [account]="account"></my-account-report>
<my-account-report #accountReportModal></my-account-report>
</ng-container>

View file

@ -162,7 +162,7 @@ export class AccountsComponent implements OnInit, OnDestroy {
}
private showReportModal () {
this.accountReportModal.show()
this.accountReportModal.show(this.account)
}
private loadUserIfNeeded (account: Account) {

View file

@ -1,5 +1,5 @@
import { mapValues, pickBy } from 'lodash-es'
import { Component, Input, OnInit, ViewChild } from '@angular/core'
import { Component, OnInit, ViewChild } from '@angular/core'
import { Notifier } from '@app/core'
import { ABUSE_REASON_VALIDATOR } from '@app/shared/form-validators/abuse-validators'
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
@ -16,13 +16,12 @@ import { AbuseService } from '../abuse.service'
styleUrls: [ './report.component.scss' ]
})
export class AccountReportComponent extends FormReactive implements OnInit {
@Input() account: Account = null
@ViewChild('modal', { static: true }) modal: NgbModal
error: string = null
predefinedReasons: { id: AbusePredefinedReasonsString, label: string, description?: string, help?: string }[] = []
modalTitle: string
account: Account = null
private openedModal: NgbModalRef
@ -48,8 +47,6 @@ export class AccountReportComponent extends FormReactive implements OnInit {
}
ngOnInit () {
this.modalTitle = $localize`Report ${this.account.displayName}`
this.buildForm({
reason: ABUSE_REASON_VALIDATOR,
predefinedReasons: mapValues(abusePredefinedReasonsMap, r => null)
@ -58,7 +55,11 @@ export class AccountReportComponent extends FormReactive implements OnInit {
this.predefinedReasons = this.abuseService.getPrefefinedReasons('account')
}
show () {
show (account: Account) {
this.account = account
this.modalTitle = $localize`Report ${this.account.displayName}`
this.openedModal = this.modalService.open(this.modal, { centered: true, keyboard: false, size: 'lg' })
}