Node.js based forum software built for the modern web
If notification dropdown is double-clicked, all notifications are marked read
Julian Lam7ee584b6327e
diff --git a/public/src/modules/notifications.js b/public/src/modules/notifications.jsindex cb6a4ef04e..d3579b60ae 100644--- a/public/src/modules/notifications.js+++ b/public/src/modules/notifications.js@@ -11,14 +11,21 @@ define('notifications', ['sounds', 'translator', 'components'], function(sound,notifList = components.get('notifications/list'),notifIcon = components.get('notifications/icon');- notifTrigger.on('click', function(e) {- e.preventDefault();- if (notifContainer.hasClass('open')) {- return;- }+ notifTrigger+ .on('click', function(e) {+ e.preventDefault();+ if (notifContainer.hasClass('open')) {+ return;+ }- Notifications.loadNotifications(notifList);- });+ Notifications.loadNotifications(notifList);+ })+ .on('dblclick', function(e) {+ e.preventDefault();+ if (parseInt(notifIcon.attr('data-content'), 10) > 0) {+ Notifications.markAllRead();+ }+ });notifList.on('click', '[data-nid]', function() {var unread = $(this).hasClass('unread');@@ -33,14 +40,7 @@ define('notifications', ['sounds', 'translator', 'components'], function(sound,});});- notifContainer.on('click', '.mark-all-read', function() {- socket.emit('notifications.markAllRead', function(err) {- if (err) {- app.alertError(err.message);- }- Notifications.updateNotifCount(0);- });- });+ notifContainer.on('click', '.mark-all-read', Notifications.markAllRead);notifList.on('click', '.mark-read', function(e) {var liEl = $(this).parent(),@@ -125,5 +125,14 @@ define('notifications', ['sounds', 'translator', 'components'], function(sound,Tinycon.setBubble(count);};+ Notifications.markAllRead = function() {+ socket.emit('notifications.markAllRead', function(err) {+ if (err) {+ app.alertError(err.message);+ }+ Notifications.updateNotifCount(0);+ });+ };+return Notifications;});