Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix reporting events not working #8257

Merged
merged 2 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/views/dialogs/ReportEventDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.

import React from 'react';
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { logger } from "matrix-js-sdk/src/logger";

import { _t } from '../../../languageHandler';
import { ensureDMExists } from "../../../createRoom";
Expand Down Expand Up @@ -213,7 +214,7 @@ export default class ReportEventDialog extends React.Component<IProps, IState> {
try {
const client = MatrixClientPeg.get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any end to end tests we can add to make sure pressing send report works?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, though this code is in a bit of an awkward place to test. Would prefer to not be more invasive than I already am.

const ev = this.props.mxEvent;
if (this.moderation && this.state.nature != NonStandardValue.Admin) {
if (this.moderation && this.state.nature !== NonStandardValue.Admin) {
const nature: Nature = this.state.nature;

// Report to moderators through to the dedicated bot,
Expand All @@ -233,6 +234,7 @@ export default class ReportEventDialog extends React.Component<IProps, IState> {
}
this.props.onFinished(true);
} catch (e) {
logger.error(e);
this.setState({
busy: false,
err: e.message,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/DialogOpener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class DialogOpener {
break;
case Action.OpenReportEventDialog:
Modal.createTrackedDialog('Report Event', '', ReportEventDialog, {
event: payload.event,
mxEvent: payload.event,
}, 'mx_Dialog_reportEvent');
break;
case Action.OpenTabbedIntegrationManagerDialog:
Expand Down