From f1c80fceded8891758a92a865e1db731d061b9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 13 Apr 2021 08:04:50 +0200 Subject: [PATCH] Call onCloseDialog straigh away MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids some delay in the dialog disappearing Signed-off-by: Šimon Brandner --- src/components/views/context_menus/MessageContextMenu.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index d2ae368cec..f86cd26f32 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -144,13 +144,13 @@ export default class MessageContextMenu extends React.Component { const cli = MatrixClientPeg.get(); try { + if (this.props.onCloseDialog) this.props.onCloseDialog(); await cli.redactEvent( this.props.mxEvent.getRoomId(), this.props.mxEvent.getId(), undefined, reason ? { reason } : {}, ); - if (this.props.onCloseDialog) this.props.onCloseDialog(); } catch (e) { const code = e.errcode || e.statusCode; // only show the dialog if failing for something other than a network error @@ -194,11 +194,11 @@ export default class MessageContextMenu extends React.Component { }; onForwardClick = () => { + if (this.props.onCloseDialog) this.props.onCloseDialog(); dis.dispatch({ action: 'forward_event', event: this.props.mxEvent, }); - if (this.props.onCloseDialog) this.props.onCloseDialog(); this.closeMenu(); };