Skip to content

Node.js based forum software built for the modern web

fix: don't return promise

Barış Soner Uşaklı2f0a331f02a6
diff --git a/src/socket.io/groups.js b/src/socket.io/groups.js
index a92fd4d5f5..505c79b04f 100644
--- a/src/socket.io/groups.js
+++ b/src/socket.io/groups.js
@@ -38,7 +38,8 @@ SocketGroups.join = function (socket, data, callback) {
}
if (!meta.config.allowPrivateGroups) {
- return groups.join(data.groupName, socket.uid, callback);
+ groups.join(data.groupName, socket.uid, callback);
+ return;
}
async.parallel({
diff --git a/src/socket.io/topics/infinitescroll.js b/src/socket.io/topics/infinitescroll.js
index 11523d79b5..9172b21719 100644
--- a/src/socket.io/topics/infinitescroll.js
+++ b/src/socket.io/topics/infinitescroll.js
@@ -93,7 +93,8 @@ module.exports = function (SocketTopics) {
};
if (data.sort === 'unread') {
params.cid = data.cid;
- return topics.getUnreadTopics(params, callback);
+ topics.getUnreadTopics(params, callback);
+ return;
}
params.cids = data.cid;
params.sort = data.sort;
diff --git a/src/socket.io/user/ban.js b/src/socket.io/user/ban.js
index d84c672442..ca70884000 100644
--- a/src/socket.io/user/ban.js
+++ b/src/socket.io/user/ban.js
@@ -130,13 +130,12 @@ module.exports = function (SocketUser) {
db.setObjectField('uid:' + uid + ':ban:' + banData.timestamp, 'fromUid', callerUid, next);
},
function (next) {
- if (!reason) {
- return translator.translate('[[user:info.banned-no-reason]]', function (translated) {
- next(null, translated);
- });
+ if (reason) {
+ return next(null, reason);
}
-
- next(null, reason);
+ translator.translate('[[user:info.banned-no-reason]]', function (translated) {
+ next(null, translated);
+ });
},
function (_reason, next) {
websockets.in('uid_' + uid).emit('event:banned', {
diff --git a/test/socket.io.js b/test/socket.io.js
index 9bb2d53e43..6ad4885294 100644
--- a/test/socket.io.js
+++ b/test/socket.io.js
@@ -127,7 +127,7 @@ describe('socket.io', function () {
it('should get more unread topics', function (done) {
io.emit('topics.loadMoreSortedTopics', { after: 0, count: 10, direction: 1, sort: 'unread' }, function (err, result) {
assert.ifError(err);
- console.log(result);
+ assert(Array.isArray(result.topics));
done();
});
});