only show "can't redact" dialog when not a network error
as the redaction is queued now and might be sent later
This commit is contained in:
parent
1515f8de17
commit
a11deffe5e
1 changed files with 18 additions and 9 deletions
|
@ -119,19 +119,28 @@ module.exports = React.createClass({
|
||||||
onRedactClick: function() {
|
onRedactClick: function() {
|
||||||
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: (proceed) => {
|
onFinished: async (proceed) => {
|
||||||
if (!proceed) return;
|
if (!proceed) return;
|
||||||
|
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
cli.redactEvent(this.props.mxEvent.getRoomId(), this.props.mxEvent.getId()).catch(function(e) {
|
try {
|
||||||
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
await cli.redactEvent(
|
||||||
// display error message stating you couldn't delete this.
|
this.props.mxEvent.getRoomId(),
|
||||||
|
this.props.mxEvent.getId(),
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
const code = e.errcode || e.statusCode;
|
const code = e.errcode || e.statusCode;
|
||||||
Modal.createTrackedDialog('You cannot delete this message', '', ErrorDialog, {
|
// only show the dialog if failing for something other than a network error
|
||||||
title: _t('Error'),
|
// (e.g. no errcode or statusCode)
|
||||||
description: _t('You cannot delete this message. (%(code)s)', {code}),
|
if (typeof code !== "undefined") {
|
||||||
});
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||||
}).done();
|
// display error message stating you couldn't delete this.
|
||||||
|
Modal.createTrackedDialog('You cannot delete this message', '', ErrorDialog, {
|
||||||
|
title: _t('Error'),
|
||||||
|
description: _t('You cannot delete this message. (%(code)s)', {code}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}, 'mx_Dialog_confirmredact');
|
}, 'mx_Dialog_confirmredact');
|
||||||
this.closeMenu();
|
this.closeMenu();
|
||||||
|
|
Loading…
Reference in a new issue