check triggerEl in callbacks

This commit is contained in:
Barış Soner Uşaklı
2026-03-18 08:48:46 -04:00
parent 483a63c67b
commit 11b98583b1

View File

@@ -48,9 +48,8 @@ define('notifications', [
ev.stopPropagation();
ev.preventDefault();
}
if (triggerEl) {
triggerEl.dropdown('toggle');
}
triggerEl?.dropdown('toggle');
const unread = notifEl.hasClass('unread');
if (!unread) {
@@ -61,10 +60,10 @@ define('notifications', [
});
components.get('notifications').on('click', '.mark-all-read', () => {
Notifications.markAllRead();
triggerEl.dropdown('toggle');
triggerEl?.dropdown('toggle');
});
components.get('notifications').on('click', `[href="${config.relative_path}/notifications"]`, () => {
triggerEl.dropdown('toggle');
triggerEl?.dropdown('toggle');
});
Notifications.handleUnreadButton(notifList);