mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-27 01:39:53 +01:00
remove init socket.io
This commit is contained in:
@@ -93,8 +93,7 @@ function onMessage(socket, payload) {
|
||||
|
||||
var eventName = payload.data[0];
|
||||
var params = payload.data[1];
|
||||
var callback = typeof payload.data[payload.data.length - 1] === 'function' ? payload.data[payload.data.length - 1] : function () {
|
||||
};
|
||||
var callback = typeof payload.data[payload.data.length - 1] === 'function' ? payload.data[payload.data.length - 1] : function () {};
|
||||
|
||||
if (!eventName) {
|
||||
return winston.warn('[socket.io] Empty method name');
|
||||
|
||||
@@ -92,22 +92,6 @@ helpers.connectSocketIO = function (res, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
helpers.initSocketIO = function (callback) {
|
||||
var jar;
|
||||
request.get({
|
||||
url: nconf.get('url') + '/api/config',
|
||||
jar: jar,
|
||||
json: true,
|
||||
}, function (err, res) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
helpers.connectSocketIO(res, function (err, io) {
|
||||
callback(err, jar, io);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
helpers.uploadFile = function (uploadEndPoint, filePath, body, jar, csrf_token, callback) {
|
||||
var formData = {
|
||||
files: [
|
||||
|
||||
11
test/user.js
11
test/user.js
@@ -454,17 +454,8 @@ describe('User', function () {
|
||||
});
|
||||
|
||||
describe('not logged in', function () {
|
||||
var io;
|
||||
before(function (done) {
|
||||
helpers.initSocketIO(function (err, _jar, _io) {
|
||||
assert.ifError(err);
|
||||
io = _io;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return error if not logged in', function (done) {
|
||||
io.emit('user.updateProfile', {}, function (err) {
|
||||
socketUser.updateProfile({ uid: 0 }, {}, function (err) {
|
||||
assert.equal(err.message, '[[error:invalid-uid]]');
|
||||
done();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user