summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/components/message/message.js
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2020-06-26 09:32:32 +0000
committerSébastien Theys <seb@odoo.com>2020-06-26 11:21:35 +0000
commit1c058b72d83da3be1068961305577b0ad2ca1a2a (patch)
treec6bae7618cbe91424c4174fca2e9da39610f4124 /addons/mail/static/src/components/message/message.js
parentdc011d12463df07ac75931a5ad332aac12c020a4 (diff)
[FIX] mail: fix (inbox reply) composer event handlers (and discard)
task-2092950 closes odoo/odoo#53731 X-original-commit: c29f5776594c4d2278ce163a78d8eb917fb672c0 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com> Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/components/message/message.js')
-rw-r--r--addons/mail/static/src/components/message/message.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/addons/mail/static/src/components/message/message.js b/addons/mail/static/src/components/message/message.js
index 091c47f0090..1881b614d2c 100644
--- a/addons/mail/static/src/components/message/message.js
+++ b/addons/mail/static/src/components/message/message.js
@@ -79,6 +79,10 @@ class Message extends Component {
},
});
/**
+ * The intent of the reply button depends on the last rendered state.
+ */
+ this._wasSelected;
+ /**
* Reference to the content of the message.
*/
this._contentRef = useRef('content');
@@ -399,6 +403,7 @@ class Message extends Component {
* @private
*/
_update() {
+ this._wasSelected = this.props.isSelected;
if (!this.state.timeElapsed) {
this.state.timeElapsed = timeFromNow(this.message.date);
}
@@ -549,8 +554,15 @@ class Message extends Component {
* @param {MouseEvent} ev
*/
_onClickReply(ev) {
- ev.stopPropagation();
- this.message.replyTo();
+ // Use this._wasSelected because this.props.isSelected might be changed
+ // by a global capture click handler (for example the one from Composer)
+ // before the current handler is executed. Indeed because it does a
+ // toggle it needs to take into account the value before the click.
+ if (this._wasSelected) {
+ this.env.messaging.discuss.clearReplyingToMessage();
+ } else {
+ this.message.replyTo();
+ }
}
/**