Skip to content

A platform for community discussion. Free, open, simple.

FIX: correctly nullifies active message (#21739)

Joffrey JAFFEUX082921c4c846
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.hbs
index 2de4491b18f..99be83b02d1 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.hbs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.hbs
@@ -2,6 +2,7 @@
<div
{{did-insert this.setup}}
{{did-update this.setup this.chat.activeMessage.model.id}}
+ {{on "mouseleave" this.onMouseleave}}
{{will-destroy this.teardown}}
class={{concat-class
"chat-message-actions-container"
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.js b/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.js
index 6bb2991f98b..7461fbbdf5f 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.js
@@ -44,6 +44,21 @@ export default class ChatMessageActionsDesktop extends Component {
return this.size === FULL;
}
+ @action
+ onMouseleave(event) {
+ // if the mouse is leaving the actions menu for the actual menu, don't close it
+ // this will avoid the menu rerendering
+ if (
+ (event.toElement || event.relatedTarget)?.closest(
+ ".chat-message-container"
+ )
+ ) {
+ return;
+ }
+
+ this.chat.activeMessage = null;
+ }
+
@action
setup(element) {
this.popper?.destroy();