DEV: Remove code that is not being used.

DEV: Remove code that is not being used.

Code was added in e15c86e8c5ff9fcb8aec32d3bab641c2ab4193a9 but it isn’t necessary anymore.

Follow-up to e15c86e8c5ff9fcb8aec32d3bab641c2ab4193a9

diff --git a/app/assets/javascripts/discourse/app/models/topic-tracking-state.js b/app/assets/javascripts/discourse/app/models/topic-tracking-state.js
index 3fcbe2d..fe62df3 100644
--- a/app/assets/javascripts/discourse/app/models/topic-tracking-state.js
+++ b/app/assets/javascripts/discourse/app/models/topic-tracking-state.js
@@ -49,7 +49,6 @@ const TopicTrackingState = EmberObject.extend({
   @on("init")
   _setup() {
     this.states = new Map();
-    this.messageIncrementCallbacks = {};
     this.stateChangeCallbacks = {};
     this._trackedTopicLimit = 4000;
   },
@@ -381,7 +380,7 @@ const TopicTrackingState = EmberObject.extend({
    * in-memory state.
    *
    * Any state changes will make a callback to all state change callbacks defined
-   * via onStateChange and all message increment callbacks defined via onMessageIncrement
+   * via onStateChange.
    *
    * @method sync
    * @param {TopicList} list
@@ -410,19 +409,12 @@ const TopicTrackingState = EmberObject.extend({
 
   incrementMessageCount() {
     this.incrementProperty("messageCount");
-    Object.values(this.messageIncrementCallbacks).forEach((cb) => cb());
   },
 
   _generateCallbackId() {
     return Math.random().toString(12).substr(2, 9);
   },
 
-  onMessageIncrement(cb) {
-    let callbackId = this._generateCallbackId();
-    this.messageIncrementCallbacks[callbackId] = cb;
-    return callbackId;
-  },
-
   onStateChange(cb) {
     let callbackId = this._generateCallbackId();
     this.stateChangeCallbacks[callbackId] = cb;
diff --git a/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js b/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js
index c910a3c..56b94a8 100644
--- a/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js
@@ -451,22 +451,14 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) {
         ]);
       });
 
-      test("message count is incremented and callback is called", function (assert) {
-        let messageIncrementCalled = false;
-        trackingState.onMessageIncrement(() => {
-          messageIncrementCalled = true;
-        });
+      test("message count is incremented", function (assert) {
         publishToMessageBus(`/unread/${currentUser.id}`, unreadTopicPayload);
+
         assert.equal(
           trackingState.messageCount,
           1,
           "message count incremented"
         );
-        assert.equal(
-          messageIncrementCalled,
-          true,
-          "message increment callback called"
-        );
       });
 
       test("state is modified and callback is called", function (assert) {
@@ -617,22 +609,14 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) {
         );
       });
 
-      test("message count is incremented and callback is called", function (assert) {
-        let messageIncrementCalled = false;
-        trackingState.onMessageIncrement(() => {
-          messageIncrementCalled = true;
-        });
+      test("message count is incremented", function (assert) {
         publishToMessageBus("/new", newTopicPayload);
+
         assert.equal(
           trackingState.messageCount,
           1,
           "message count incremented"
         );
-        assert.equal(
-          messageIncrementCalled,
-          true,
-          "message increment callback called"
-        );
       });
 
       test("state is modified and callback is called", function (assert) {

GitHub sha: 2fb17b7b17d02431562949f40b3bff8e1ae14889

This commit appears in #14006 which was approved by martin. It was merged by tgxworld.