mirror of https://github.com/vector-im/riot-web
Merge pull request #5260 from orangecms/redact-with-reason
add support for giving reason when redactingpull/21833/head
commit
c13891c670
|
@ -149,7 +149,7 @@ export default class MessageContextMenu extends React.Component {
|
||||||
onRedactClick = () => {
|
onRedactClick = () => {
|
||||||
const ConfirmRedactDialog = sdk.getComponent("dialogs.ConfirmRedactDialog");
|
const ConfirmRedactDialog = sdk.getComponent("dialogs.ConfirmRedactDialog");
|
||||||
Modal.createTrackedDialog('Confirm Redact Dialog', '', ConfirmRedactDialog, {
|
Modal.createTrackedDialog('Confirm Redact Dialog', '', ConfirmRedactDialog, {
|
||||||
onFinished: async (proceed) => {
|
onFinished: async (proceed, reason) => {
|
||||||
if (!proceed) return;
|
if (!proceed) return;
|
||||||
|
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
|
@ -157,6 +157,8 @@ export default class MessageContextMenu extends React.Component {
|
||||||
await cli.redactEvent(
|
await cli.redactEvent(
|
||||||
this.props.mxEvent.getRoomId(),
|
this.props.mxEvent.getRoomId(),
|
||||||
this.props.mxEvent.getId(),
|
this.props.mxEvent.getId(),
|
||||||
|
undefined,
|
||||||
|
reason ? { reason } : {},
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const code = e.errcode || e.statusCode;
|
const code = e.errcode || e.statusCode;
|
||||||
|
|
|
@ -23,15 +23,17 @@ import { _t } from '../../../languageHandler';
|
||||||
*/
|
*/
|
||||||
export default class ConfirmRedactDialog extends React.Component {
|
export default class ConfirmRedactDialog extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const QuestionDialog = sdk.getComponent('views.dialogs.QuestionDialog');
|
const TextInputDialog = sdk.getComponent('views.dialogs.TextInputDialog');
|
||||||
return (
|
return (
|
||||||
<QuestionDialog onFinished={this.props.onFinished}
|
<TextInputDialog onFinished={this.props.onFinished}
|
||||||
title={_t("Confirm Removal")}
|
title={_t("Confirm Removal")}
|
||||||
description={
|
description={
|
||||||
_t("Are you sure you wish to remove (delete) this event? " +
|
_t("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.")}
|
"Note that if you delete a room name or topic change, it could undo the change.")}
|
||||||
|
placeholder={_t("Reason (optional)")}
|
||||||
|
focus
|
||||||
button={_t("Remove")}>
|
button={_t("Remove")}>
|
||||||
</QuestionDialog>
|
</TextInputDialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1962,6 +1962,7 @@
|
||||||
"Removing…": "Removing…",
|
"Removing…": "Removing…",
|
||||||
"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.",
|
"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?",
|
"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.",
|
||||||
"Clear all data": "Clear all data",
|
"Clear all data": "Clear all data",
|
||||||
|
|
Loading…
Reference in New Issue