From 3f52de2f5b2bc5bbc63ae267dca892e127e7b8aa Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 14 Jun 2023 09:49:17 +0100 Subject: [PATCH] Don't warn about the effects of redacting state events when redacting non-state-events (#11071) --- .../views/dialogs/ConfirmAndWaitRedactDialog.tsx | 4 +++- src/components/views/dialogs/ConfirmRedactDialog.tsx | 12 ++++++++---- src/components/views/messages/EditHistoryMessage.tsx | 1 + src/i18n/strings/en_EN.json | 3 ++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx b/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx index a792ccbd63..9989dc5434 100644 --- a/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx +++ b/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx @@ -15,6 +15,7 @@ limitations under the License. */ import React from "react"; +import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { _t } from "../../../languageHandler"; import ConfirmRedactDialog from "./ConfirmRedactDialog"; @@ -23,6 +24,7 @@ import BaseDialog from "./BaseDialog"; import Spinner from "../elements/Spinner"; interface IProps { + event: MatrixEvent; redact: () => Promise; onFinished: (success?: boolean) => void; } @@ -91,7 +93,7 @@ export default class ConfirmAndWaitRedactDialog extends React.PureComponent; + return ; } } } diff --git a/src/components/views/dialogs/ConfirmRedactDialog.tsx b/src/components/views/dialogs/ConfirmRedactDialog.tsx index f51b89131c..9c1fa2b181 100644 --- a/src/components/views/dialogs/ConfirmRedactDialog.tsx +++ b/src/components/views/dialogs/ConfirmRedactDialog.tsx @@ -26,6 +26,7 @@ import ErrorDialog from "./ErrorDialog"; import TextInputDialog from "./TextInputDialog"; interface IProps { + event: MatrixEvent; onFinished(success?: false, reason?: void): void; onFinished(success: true, reason?: string): void; } @@ -35,14 +36,16 @@ interface IProps { */ export default class ConfirmRedactDialog extends React.Component { public render(): React.ReactNode { + let description = _t("Are you sure you wish to remove (delete) this event?"); + if (this.props.event.isState()) { + description += " " + _t("Note that removing room changes like this could undo the change."); + } + return ( => { if (!proceed) return; diff --git a/src/components/views/messages/EditHistoryMessage.tsx b/src/components/views/messages/EditHistoryMessage.tsx index 3531e6e5fa..0b1d830fdf 100644 --- a/src/components/views/messages/EditHistoryMessage.tsx +++ b/src/components/views/messages/EditHistoryMessage.tsx @@ -79,6 +79,7 @@ export default class EditHistoryMessage extends React.PureComponent { await cli.redactEvent(event.getRoomId()!, event.getId()!); }, diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 84ca822e85..4b5c15f333 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2739,8 +2739,9 @@ "Changelog": "Changelog", "You cannot delete this message. (%(code)s)": "You cannot delete this message. (%(code)s)", "Removing…": "Removing…", + "Are you sure you wish to remove (delete) this event?": "Are you sure you wish to remove (delete) this event?", + "Note that removing room changes like this could undo the change.": "Note that removing room changes like this could undo the change.", "Confirm Removal": "Confirm Removal", - "Are you sure you wish to remove (delete) this event? Note that if you delete a room name or topic change, it could undo the change.": "Are you sure you wish to remove (delete) this event? Note that if you delete a room name or topic change, it could undo the change.", "Reason (optional)": "Reason (optional)", "Clear all data in this session?": "Clear all data in this session?", "Clearing all data from this session is permanent. Encrypted messages will be lost unless their keys have been backed up.": "Clearing all data from this session is permanent. Encrypted messages will be lost unless their keys have been backed up.",