mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 22:26:26 +08:00
FIX: Stop tracking incoming message after navigating away take 2. (#14508)
* FIX: Stop tracking incoming message after navigating away take 2.
Previous fix in d82e5cd37c
resulted in
counts being flappy as we cleared the active inbox between routes.
Co-authored-by: Osama Sayegh <asooomaasoooma90@gmail.com>
This commit is contained in:
parent
085eb56ea4
commit
12856ab8c2
|
@ -78,21 +78,20 @@ const PrivateMessageTopicTrackingState = EmberObject.extend({
|
|||
|
||||
trackIncoming(inbox, filter, group) {
|
||||
this.setProperties({ inbox, filter, activeGroup: group });
|
||||
this.set("isTrackingIncoming", true);
|
||||
},
|
||||
|
||||
resetIncomingTracking() {
|
||||
if (this.inbox) {
|
||||
if (this.isTrackingIncoming) {
|
||||
this.set("newIncoming", []);
|
||||
}
|
||||
},
|
||||
|
||||
stopIncomingTracking() {
|
||||
if (this.inbox) {
|
||||
if (this.isTrackingIncoming) {
|
||||
this.setProperties({
|
||||
isTrackingIncoming: false,
|
||||
newIncoming: [],
|
||||
inbox: null,
|
||||
filter: null,
|
||||
activeGroup: null,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -213,7 +212,7 @@ const PrivateMessageTopicTrackingState = EmberObject.extend({
|
|||
},
|
||||
|
||||
_notifyIncoming(topicId) {
|
||||
if (this.newIncoming.indexOf(topicId) === -1) {
|
||||
if (this.isTrackingIncoming && this.newIncoming.indexOf(topicId) === -1) {
|
||||
this.newIncoming.pushObject(topicId);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -423,6 +423,21 @@ acceptance(
|
|||
);
|
||||
});
|
||||
|
||||
test("incoming messages is not tracked on non user messages route", async function (assert) {
|
||||
await visit("/u/charlie/messages");
|
||||
await visit("/t/13");
|
||||
|
||||
publishNewToMessageBus({ topicId: 1, userId: 5 });
|
||||
|
||||
await visit("/t/13"); // await re-render
|
||||
await visit("/u/charlie/messages");
|
||||
|
||||
assert.ok(
|
||||
!exists(".show-mores"),
|
||||
"does not display the topic incoming info"
|
||||
);
|
||||
});
|
||||
|
||||
test("dismissing all unread messages", async function (assert) {
|
||||
await visit("/u/charlie/messages/unread");
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user