FEATURE: only scroll to bottom for discobot

FEATURE: only scroll to bottom for discobot

Non discobot replies on PMs triggering scroll cause confusion.

diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6
index e5206b4..dcac19a 100644
--- a/app/assets/javascripts/discourse/controllers/topic.js.es6
+++ b/app/assets/javascripts/discourse/controllers/topic.js.es6
@@ -1272,10 +1272,14 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
           }
         }
 
+        // scroll to bottom is very specific to new posts from discobot
+        // hence the -2 check (dicobot id). We can shift all this code
+        // to discobot plugin longer term
         if (
           topic.get("isPrivateMessage") &&
           this.currentUser &&
           this.currentUser.get("id") !== data.user_id &&
+          data.user_id === -2 &&
           data.type === "created"
         ) {
           const postNumber = data.post_number;

GitHub sha: 267d129f

1 Like