Skip to content

Node.js based forum software built for the modern web

refactor: backwards compat. for loadNotifications function

Barış Soner Uşaklı6a98b7e8d91a
diff --git a/public/src/modules/notifications.js b/public/src/modules/notifications.js
index 7d5da2ac3b..7e4cf91ebb 100644
--- a/public/src/modules/notifications.js
+++ b/public/src/modules/notifications.js
@@ -30,6 +30,12 @@ define('notifications', [
hooks.on('filter:notifications.load', _addTimeagoString);
Notifications.loadNotifications = function (triggerEl, notifList, callback) {
+ // backwards compatibilty for old signature (notifList, callback)
+ if (triggerEl && typeof notifList === 'function') {
+ callback = notifList;
+ notifList = triggerEl;
+ triggerEl = null;
+ }
callback = callback || function () {};
api.get('/notifications').then((data) => {
const notifs = data.unread.concat(data.read).sort(function (a, b) {