FIX: prevents messageBus subscriptions to leak

approved
#1

FIX: prevents messageBus subscriptions to leak

diff --git a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6 b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
index adf540e..bb70abb 100644
--- a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
+++ b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
@@ -200,9 +200,12 @@ function initialize(api) {
         this.appEvents.trigger("header:update-topic", topic);
       });
     },
+
     unsubscribe() {
-      this._super();
-      if (!this.get("content.id")) return;
+      this._super(...arguments);
+
+      if (!this.get("model.id")) return;
+
       this.messageBus.unsubscribe("/staff/topic-assignment");
     }
   });

GitHub sha: fe80298a

1 Like
#2

I wonder if we should grep all the official plugins for content for other culprits like this.

1 Like
#3

can do a quick check yes

1 Like
#4

These seems legit for this.get('content:

Nothing else for this.get("content

2 Likes
Approved #5