Don't warn about the effects of redacting state events when redacting non-state-events (#11071)
This commit is contained in:
parent
788c1c8f13
commit
3f52de2f5b
4 changed files with 14 additions and 6 deletions
|
@ -15,6 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
|
|
||||||
import { _t } from "../../../languageHandler";
|
import { _t } from "../../../languageHandler";
|
||||||
import ConfirmRedactDialog from "./ConfirmRedactDialog";
|
import ConfirmRedactDialog from "./ConfirmRedactDialog";
|
||||||
|
@ -23,6 +24,7 @@ import BaseDialog from "./BaseDialog";
|
||||||
import Spinner from "../elements/Spinner";
|
import Spinner from "../elements/Spinner";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
|
event: MatrixEvent;
|
||||||
redact: () => Promise<void>;
|
redact: () => Promise<void>;
|
||||||
onFinished: (success?: boolean) => void;
|
onFinished: (success?: boolean) => void;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +93,7 @@ export default class ConfirmAndWaitRedactDialog extends React.PureComponent<IPro
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return <ConfirmRedactDialog onFinished={this.onParentFinished} />;
|
return <ConfirmRedactDialog event={this.props.event} onFinished={this.onParentFinished} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import ErrorDialog from "./ErrorDialog";
|
||||||
import TextInputDialog from "./TextInputDialog";
|
import TextInputDialog from "./TextInputDialog";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
|
event: MatrixEvent;
|
||||||
onFinished(success?: false, reason?: void): void;
|
onFinished(success?: false, reason?: void): void;
|
||||||
onFinished(success: true, reason?: string): void;
|
onFinished(success: true, reason?: string): void;
|
||||||
}
|
}
|
||||||
|
@ -35,14 +36,16 @@ interface IProps {
|
||||||
*/
|
*/
|
||||||
export default class ConfirmRedactDialog extends React.Component<IProps> {
|
export default class ConfirmRedactDialog extends React.Component<IProps> {
|
||||||
public render(): React.ReactNode {
|
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 (
|
return (
|
||||||
<TextInputDialog
|
<TextInputDialog
|
||||||
onFinished={this.props.onFinished}
|
onFinished={this.props.onFinished}
|
||||||
title={_t("Confirm Removal")}
|
title={_t("Confirm Removal")}
|
||||||
description={_t(
|
description={description}
|
||||||
"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.",
|
|
||||||
)}
|
|
||||||
placeholder={_t("Reason (optional)")}
|
placeholder={_t("Reason (optional)")}
|
||||||
focus
|
focus
|
||||||
button={_t("Remove")}
|
button={_t("Remove")}
|
||||||
|
@ -68,6 +71,7 @@ export function createRedactEventDialog({
|
||||||
Modal.createDialog(
|
Modal.createDialog(
|
||||||
ConfirmRedactDialog,
|
ConfirmRedactDialog,
|
||||||
{
|
{
|
||||||
|
event: mxEvent,
|
||||||
onFinished: async (proceed, reason): Promise<void> => {
|
onFinished: async (proceed, reason): Promise<void> => {
|
||||||
if (!proceed) return;
|
if (!proceed) return;
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
|
||||||
Modal.createDialog(
|
Modal.createDialog(
|
||||||
ConfirmAndWaitRedactDialog,
|
ConfirmAndWaitRedactDialog,
|
||||||
{
|
{
|
||||||
|
event,
|
||||||
redact: async () => {
|
redact: async () => {
|
||||||
await cli.redactEvent(event.getRoomId()!, event.getId()!);
|
await cli.redactEvent(event.getRoomId()!, event.getId()!);
|
||||||
},
|
},
|
||||||
|
|
|
@ -2739,8 +2739,9 @@
|
||||||
"Changelog": "Changelog",
|
"Changelog": "Changelog",
|
||||||
"You cannot delete this message. (%(code)s)": "You cannot delete this message. (%(code)s)",
|
"You cannot delete this message. (%(code)s)": "You cannot delete this message. (%(code)s)",
|
||||||
"Removing…": "Removing…",
|
"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",
|
"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)",
|
"Reason (optional)": "Reason (optional)",
|
||||||
"Clear all data in this session?": "Clear all data in this session?",
|
"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.",
|
"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.",
|
||||||
|
|
Loading…
Reference in a new issue