FIX: Remove incoming messages for read events. (#14352)

FIX: Remove incoming messages for read events. (#14352)

This prevents the incoming message banner from showing unnecessarily when reading a post and then navigating back to the unread list.

diff --git a/app/assets/javascripts/discourse/app/models/private-message-topic-tracking-state.js b/app/assets/javascripts/discourse/app/models/private-message-topic-tracking-state.js
index a7fafae..1cb6810 100644
--- a/app/assets/javascripts/discourse/app/models/private-message-topic-tracking-state.js
+++ b/app/assets/javascripts/discourse/app/models/private-message-topic-tracking-state.js
@@ -152,12 +152,7 @@ const PrivateMessageTopicTrackingState = EmberObject.extend({
       case "read":
         this._modifyState(message.topic_id, message.payload);
 
-        if (
-          this.filter === UNREAD_FILTER &&
-          this._shouldDisplayMessageForInbox(message)
-        ) {
-          this._notifyIncoming(message.topic_id);
-        }
+        break;
       case "unread":
         this._modifyState(message.topic_id, message.payload);
 
@@ -178,6 +173,8 @@ const PrivateMessageTopicTrackingState = EmberObject.extend({
         ) {
           this._notifyIncoming(message.topic_id);
         }
+
+        break;
     }
   },
 
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js
index 29372f6..99772ca 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js
@@ -280,16 +280,6 @@ acceptance(
       );
     };
 
-    test("incoming read message on unread filter", async function (assert) {
-      await visit("/u/charlie/messages/unread");
-
-      publishReadToMessageBus({ topicId: 1 });
-
-      await visit("/u/charlie/messages/unread"); // wait for re-render
-
-      assert.ok(exists(".show-mores"), `displays the topic incoming info`);
-    });
-
     test("incoming group archive message acted by current user", async function (assert) {
       await visit("/u/charlie/messages");
 

GitHub sha: 98dcbd214c78d0ca81a0f6c82c02b39d3da2b5be

This commit appears in #14352 which was approved by lis2. It was merged by tgxworld.