mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
FIX: topic tracking stage error when no tags (#18901)
When topic Tag is tracked and payload doesn't contain tags, it was throwing an error.
This commit is contained in:
parent
4116094e54
commit
ff21651d64
|
@ -207,7 +207,7 @@ const TopicTrackingState = EmberObject.extend({
|
|||
}
|
||||
}
|
||||
|
||||
if (filterTag && !data.payload.tags.includes(filterTag)) {
|
||||
if (filterTag && !data.payload.tags?.includes(filterTag)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,16 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) {
|
|||
0,
|
||||
"pending tag new counts"
|
||||
);
|
||||
|
||||
// Ensure it is not throwing an error when filterTag is set and message payload is missing tags
|
||||
trackingState.trackIncoming("tag/test/l/latest");
|
||||
trackingState.notifyIncoming({
|
||||
message_type: "new_topic",
|
||||
topic_id: 4,
|
||||
payload: { category_id: 2 },
|
||||
});
|
||||
const testTagCount = trackingState.countTags(["test"]);
|
||||
assert.strictEqual(testTagCount["test"].unreadCount, 0);
|
||||
});
|
||||
|
||||
test("tag counts - with total", function (assert) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user