FIX: Don't publish typing presence if composer isn't opened.

FIX: Don’t publish typing presence if composer isn’t opened.

Hitting cancel on composer will set composer’s reply and title to null causing our observer to fire.

diff --git a/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6 b/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6
index 110bfb4..39e7e8e 100644
--- a/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6
+++ b/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6
@@ -62,7 +62,10 @@ export default Component.extend({
   _typing() {
     const action = this.get("model.action");
 
-    if (action !== REPLY && action !== EDIT) {
+    if (
+      (action !== REPLY && action !== EDIT) ||
+      !this.get("model.composerOpened")
+    ) {
       return;
     }
 

GitHub sha: a849bdf0

1 Like