FIX: Include liked_consolidated and reaction types in the likes tab unread count (#21198)

This commit is contained in:
Osama Sayegh 2023-04-24 07:33:09 +03:00 committed by GitHub
parent 24ec06ff85
commit 2bcbabc087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -63,7 +63,11 @@ const CORE_TOP_TABS = [
}
get count() {
return this.getUnreadCountForType("liked");
return (
this.getUnreadCountForType("liked") +
this.getUnreadCountForType("liked_consolidated") +
this.getUnreadCountForType("reaction")
);
}
// TODO(osama): reaction is a type used by the reactions plugin, but it's

View File

@ -303,4 +303,23 @@ module("Integration | Component | user-menu", function (hooks) {
);
assert.strictEqual(queryAll("#quick-access-review-queue ul li").length, 8);
});
test("count on the likes tab", async function (assert) {
this.currentUser.set("grouped_unread_notifications", {
[NOTIFICATION_TYPES.liked]: 1,
[NOTIFICATION_TYPES.liked_consolidated]: 2,
[NOTIFICATION_TYPES.reaction]: 3,
[NOTIFICATION_TYPES.bookmark_reminder]: 10,
});
await render(template);
const likesCountBadge = query(
"#user-menu-button-likes .badge-notification"
);
assert.strictEqual(
likesCountBadge.textContent,
(1 + 2 + 3).toString(),
"combines unread counts for `liked`, `liked_consolidated` and `reaction` types"
);
});
});