FIX: Remove dismiss read topics from PM topic tracking state. (#14287)
Follow-up to fc1fd1b416
This commit is contained in:
parent
85e95c9ec5
commit
c92818ae5f
|
@ -51,8 +51,12 @@ export default Mixin.create({
|
||||||
|
|
||||||
promise.then((result) => {
|
promise.then((result) => {
|
||||||
if (result && result.topic_ids) {
|
if (result && result.topic_ids) {
|
||||||
|
if (options.private_message_inbox) {
|
||||||
|
this.pmTopicTrackingState.removeTopics(result.topic_ids);
|
||||||
|
} else {
|
||||||
this.topicTrackingState.removeTopics(result.topic_ids);
|
this.topicTrackingState.removeTopics(result.topic_ids);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.send("closeModal");
|
this.send("closeModal");
|
||||||
this.send(
|
this.send(
|
||||||
|
|
|
@ -81,6 +81,15 @@ const PrivateMessageTopicTrackingState = EmberObject.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
removeTopics(topicIds) {
|
||||||
|
if (!this.isTracking) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
topicIds.forEach((topicId) => this.states.delete(topicId));
|
||||||
|
this.incrementProperty("statesModificationCounter");
|
||||||
|
},
|
||||||
|
|
||||||
_userChannel() {
|
_userChannel() {
|
||||||
return `${this.CHANNEL_PREFIX}/user/${this.currentUser.id}`;
|
return `${this.CHANNEL_PREFIX}/user/${this.currentUser.id}`;
|
||||||
},
|
},
|
||||||
|
|
|
@ -166,7 +166,9 @@ acceptance(
|
||||||
fetchUserNew = true;
|
fetchUserNew = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return helper.response({});
|
return helper.response({
|
||||||
|
topic_ids: [1, 2, 3],
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -459,6 +461,10 @@ acceptance(
|
||||||
test("dismissing all unread messages", async function (assert) {
|
test("dismissing all unread messages", async function (assert) {
|
||||||
await visit("/u/charlie/messages/unread");
|
await visit("/u/charlie/messages/unread");
|
||||||
|
|
||||||
|
publishUnreadToMessageBus({ topicId: 1, userId: 5 });
|
||||||
|
publishUnreadToMessageBus({ topicId: 2, userId: 5 });
|
||||||
|
publishUnreadToMessageBus({ topicId: 3, userId: 5 });
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
count(".topic-list-item"),
|
count(".topic-list-item"),
|
||||||
3,
|
3,
|
||||||
|
@ -468,6 +474,12 @@ acceptance(
|
||||||
await click(".btn.dismiss-read");
|
await click(".btn.dismiss-read");
|
||||||
await click("#dismiss-read-confirm");
|
await click("#dismiss-read-confirm");
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
query(".messages-nav li a.unread").innerText.trim(),
|
||||||
|
I18n.t("user.messages.unread"),
|
||||||
|
"displays the right count"
|
||||||
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
count(".topic-list-item"),
|
count(".topic-list-item"),
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in New Issue