From f52973499eb04e002f072d5f484f3f792c200437 Mon Sep 17 00:00:00 2001 From: Chris Brame Date: Wed, 20 Apr 2022 22:32:12 -0400 Subject: [PATCH] fix(notifications): issue where notifications would not update #495 --- src/sass/partials/topnav.sass | 4 ++-- src/socketio/notificationSocket.js | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/sass/partials/topnav.sass b/src/sass/partials/topnav.sass index 099f5abdd..ea2e92814 100644 --- a/src/sass/partials/topnav.sass +++ b/src/sass/partials/topnav.sass @@ -242,7 +242,7 @@ width: 100% background: lighten($page_content_right_bg, 10%) !important border-bottom: 1px solid rgba(0,0,0,0.2) - height: 72px + height: 62px max-height: 80px line-height: normal &:hover @@ -254,7 +254,7 @@ .item display: block width: 100% - height: 71px + height: 61px padding: 10px !important background: lighten($page_content_right_bg, 10%) !important line-height: normal !important diff --git a/src/socketio/notificationSocket.js b/src/socketio/notificationSocket.js index d23b4189d..99c2d7b60 100644 --- a/src/socketio/notificationSocket.js +++ b/src/socketio/notificationSocket.js @@ -13,7 +13,7 @@ */ var _ = require('lodash') var async = require('async') -var winston = require('winston') +var winston = require('../logger') var utils = require('../helpers/utils') var events = {} @@ -30,9 +30,10 @@ function eventLoop () { } function updateNotifications () { - _.each(io.sockets.sockets, function (socket) { - var notifications = {} - var notificationSchema = require('../models/notification') + const notificationSchema = require('../models/notification') + // eslint-disable-next-line no-unused-vars + for (const [_, socket] of io.of('/').sockets) { + const notifications = {} async.parallel( [ function (done) { @@ -48,6 +49,7 @@ function updateNotifications () { if (err) return done(err) notifications.count = count + return done() }) } @@ -61,7 +63,7 @@ function updateNotifications () { utils.sendToSelf(socket, 'updateNotifications', notifications) } ) - }) + } } function updateAllNotifications (socket) {