From 0316deb6c58fbcaddfe2b0f9a3a3db963fbe2112 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 7 May 2019 12:06:50 +0100 Subject: [PATCH] Restore access to message quote option on first click This repairs access to the "Quote" option of the message context menu by passing down a getter so that we always access the most recent tile and reply thread instances. This ensures the context menu uses the newest information about the current event when determining menu options to show. Fixes https://github.com/vector-im/riot-web/issues/9639 --- src/components/views/messages/MessageActionBar.js | 8 +++++--- src/components/views/rooms/EventTile.js | 12 ++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/views/messages/MessageActionBar.js b/src/components/views/messages/MessageActionBar.js index 76bae137f5..74eb4165e9 100644 --- a/src/components/views/messages/MessageActionBar.js +++ b/src/components/views/messages/MessageActionBar.js @@ -30,8 +30,8 @@ export default class MessageActionBar extends React.PureComponent { static propTypes = { mxEvent: PropTypes.object.isRequired, permalinkCreator: PropTypes.object, - tile: PropTypes.element, - replyThread: PropTypes.element, + getTile: PropTypes.func, + getReplyThread: PropTypes.func, onFocusChange: PropTypes.func, }; @@ -99,7 +99,9 @@ export default class MessageActionBar extends React.PureComponent { const x = buttonRect.right + window.pageXOffset; const y = (buttonRect.top + (buttonRect.height / 2) + window.pageYOffset) - 19; - const {tile, replyThread} = this.props; + const { getTile, getReplyThread } = this.props; + const tile = getTile && getTile(); + const replyThread = getReplyThread && getReplyThread(); let e2eInfoCallback = null; if (this.props.mxEvent.isEncrypted()) { diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 6bec3f4fff..59025bf431 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -464,6 +464,14 @@ module.exports = withMatrixClient(React.createClass({ }); }, + getTile() { + return this.refs.tile; + }, + + getReplyThread() { + return this.refs.replyThread; + }, + render: function() { const MessageTimestamp = sdk.getComponent('messages.MessageTimestamp'); const SenderProfile = sdk.getComponent('messages.SenderProfile'); @@ -580,8 +588,8 @@ module.exports = withMatrixClient(React.createClass({ const actionBar = ;