From ae9809a7d021fcaf01ee482a9c6c59fdd50125a6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 7 Dec 2021 11:05:45 +0100 Subject: [PATCH 1/2] Fix report modal error --- client/src/app/+accounts/accounts.component.html | 2 +- client/src/app/+accounts/accounts.component.ts | 2 +- .../report-modals/account-report.component.ts | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/client/src/app/+accounts/accounts.component.html b/client/src/app/+accounts/accounts.component.html index 245edfd58..0bb24de2e 100644 --- a/client/src/app/+accounts/accounts.component.html +++ b/client/src/app/+accounts/accounts.component.html @@ -85,5 +85,5 @@ - + diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts index 3cb117fcc..0dcbc250a 100644 --- a/client/src/app/+accounts/accounts.component.ts +++ b/client/src/app/+accounts/accounts.component.ts @@ -162,7 +162,7 @@ export class AccountsComponent implements OnInit, OnDestroy { } private showReportModal () { - this.accountReportModal.show() + this.accountReportModal.show(this.account) } private loadUserIfNeeded (account: Account) { diff --git a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts index 4ec02f11a..78c9b3382 100644 --- a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts +++ b/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts @@ -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' }) } From 6e14e40053961cf0b2f55710847f21a3e1b5b627 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 7 Dec 2021 11:06:35 +0100 Subject: [PATCH 2/2] Fix iframe allow-popups for oembed --- server/controllers/services.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/controllers/services.ts b/server/controllers/services.ts index 8a8a95486..9151e1b04 100644 --- a/server/controllers/services.ts +++ b/server/controllers/services.ts @@ -98,7 +98,7 @@ function buildOEmbed (options: { thumbnailUrl = undefined } - const html = `` const json: any = {