fix: #12728, don't display unread badge if nav link doesn't exist

This commit is contained in:
Barış Soner Uşaklı
2024-08-15 13:12:17 -04:00
parent c3f02b74cc
commit 6f7eecd183

View File

@@ -97,6 +97,7 @@ define('forum/header/unread', ['hooks'], function (hooks) {
.toggleClass('hidden', count <= 0)
.text(count);
if (navLink.length) {
// persona mobile menu uses data-content
$('#mobile-menu [data-unread-url="' + url + '"]')
.attr('data-content', countText);
@@ -105,6 +106,7 @@ define('forum/header/unread', ['hooks'], function (hooks) {
$('[component="unread/count"][data-unread-url="' + url + '"]')
.toggleClass('hidden', count <= 0)
.text(countText);
}
hooks.fire('action:unread.updateCount', { url, count });
}