diff --git a/src/controllers/accounts.js b/src/controllers/accounts.js index 600c6a2347..eb78226145 100644 --- a/src/controllers/accounts.js +++ b/src/controllers/accounts.js @@ -22,8 +22,7 @@ var fs = require('fs'), languages = require('../languages'), image = require('../image'), file = require('../file'), - helpers = require('./helpers'), - websockets = require('../socket.io'); + helpers = require('./helpers'); function getUserDataByUserSlug(userslug, callerUID, callback) { user.getUidByUserslug(userslug, function(err, uid) { @@ -91,7 +90,7 @@ function getUserDataByUserSlug(userslug, callerUID, callback) { userData.disableSignatures = meta.config.disableSignatures !== undefined && parseInt(meta.config.disableSignatures, 10) === 1; userData['email:confirmed'] = !!parseInt(userData['email:confirmed'], 10); userData.profile_links = results.profile_links; - userData.status = websockets.isUserOnline(userData.uid) ? (userData.status || 'online') : 'offline'; + userData.status = require('../socket.io').isUserOnline(userData.uid) ? (userData.status || 'online') : 'offline'; userData.banned = parseInt(userData.banned, 10) === 1; userData.websiteName = userData.website.replace(validator.escape('http://'), '').replace(validator.escape('https://'), ''); userData.followingCount = parseInt(userData.followingCount, 10) || 0; diff --git a/src/messaging.js b/src/messaging.js index 86ecf7014d..4a367fbd38 100644 --- a/src/messaging.js +++ b/src/messaging.js @@ -10,7 +10,6 @@ var db = require('./database'), utils = require('../public/src/utils'), notifications = require('./notifications'), userNotifications = require('./user/notifications'), - websockets = require('./socket.io'), emailer = require('./emailer'); (function(Messaging) { @@ -257,7 +256,7 @@ var db = require('./database'), results.users.forEach(function(user, index) { if (user) { user.unread = results.unread[index]; - user.status = websockets.isUserOnline(user.uid) ? user.status : 'offline'; + user.status = require('./socket.io').isUserOnline(user.uid) ? user.status : 'offline'; } }); @@ -320,7 +319,7 @@ var db = require('./database'), }; function sendNotifications(fromuid, touid, messageObj, callback) { - if (websockets.isUserOnline(touid)) { + if (require('./socket.io').isUserOnline(touid)) { return callback(); } diff --git a/src/posts/user.js b/src/posts/user.js index 555b60e46d..02b7816ed9 100644 --- a/src/posts/user.js +++ b/src/posts/user.js @@ -6,7 +6,6 @@ var async = require('async'), user = require('../user'), groups = require('../groups'), meta = require('../meta'), - websockets = require('../socket.io'), postTools = require('../postTools'), plugins = require('../plugins'); @@ -22,7 +21,7 @@ module.exports = function(Posts) { user.getMultipleUserFields(uids, ['uid', 'username', 'userslug', 'reputation', 'postcount', 'picture', 'signature', 'banned', 'status'], next); }, online: function(next) { - websockets.isUsersOnline(uids, next); + require('../socket.io').isUsersOnline(uids, next); } }, function(err, results) { if (err) {