From 2045f51312bb278d37990f4daa88147090bc3793 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Wed, 29 Apr 2020 15:23:17 +1000 Subject: [PATCH] FIX: correctly account for direct replies with presence followup to 301a0fa5, we were not checking the action so we were publishing some messages from composers we did not intend to --- .../components/composer-presence-display.js.es6 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 e6a366087b9..72edf988f71 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 @@ -6,6 +6,7 @@ import discourseComputed, { on } from "discourse-common/utils/decorators"; import { REPLYING, CLOSED, EDITING } from "../lib/presence-manager"; +import { REPLY, EDIT } from "discourse/models/composer"; export default Component.extend({ // Passed in variables @@ -44,12 +45,18 @@ export default Component.extend({ @observes("reply", "title") typing() { if (this.presenceManager) { + let action = this.action; + + if (action !== REPLY && action !== EDIT) { + return; + } + const postId = this.get("post.id"); this._throttle = this.presenceManager.throttlePublish( - postId ? EDITING : REPLYING, + action === EDIT ? EDITING : REPLYING, this.whisper, - postId + action === EDIT ? postId : undefined ); } },