linted socket/admin.js

v1.18.x
Julian Lam 11 years ago
parent aa689a7a29
commit 4453d055ea

@ -15,6 +15,6 @@ jQuery('document').ready(function() {
}, false); }, false);
}); });
socket.emit('api:meta.config.get', function(config) { socket.emit('api:admin.config.get', function(config) {
app.config = config; app.config = config;
}); });

@ -67,7 +67,7 @@ define(['uploader'], function(uploader) {
value = fields[x].value; value = fields[x].value;
} }
socket.emit('api:meta.config.set', { socket.emit('api:admin.config.set', {
key: key, key: key,
value: value value: value
}, function(data) { }, function(data) {
@ -116,7 +116,7 @@ define(['uploader'], function(uploader) {
}; };
Settings.remove = function(key) { Settings.remove = function(key) {
socket.emit('api:meta.config.remove', key); socket.emit('api:admin.config.remove', key);
}; };
return Settings; return Settings;

@ -1,9 +1,13 @@
"use strict";
var groups = require('../groups'), var groups = require('../groups'),
meta = require('../meta'), meta = require('../meta'),
plugins = require('../plugins'), plugins = require('../plugins'),
user = require('../user'), user = require('../user'),
topics = require('../topics'), topics = require('../topics'),
categories = require('../categories'),
CategoryTools = require('../categoryTools'), CategoryTools = require('../categoryTools'),
logger = require('../logger'),
admin = { admin = {
user: require('../admin/user'), user: require('../admin/user'),
categories: require('../admin/categories') categories: require('../admin/categories')
@ -133,13 +137,19 @@ SocketAdmin.categories.search = function(username, cid, callback, sessionData) {
next(null, userObj); next(null, userObj);
}); });
}, function(err, data) { }, function(err, data) {
if (!callback) sessionData.socket.emit('api:admin.categories.search', data); if (!callback) {
else callback(null, data); sessionData.socket.emit('api:admin.categories.search', data);
} else {
callback(null, data);
}
}); });
}); });
} else { } else {
if (!callback) sessionData.socket.emit('api:admin.user.search', null); if (!callback) {
else callback(); sessionData.socket.emit('api:admin.user.search', null);
} else {
callback();
}
} }
}; };
@ -232,4 +242,37 @@ SocketAdmin.plugins.toggle = function(plugin_id, sessionData) {
}); });
}; };
/* Configs */
SocketAdmin.config = {};
SocketAdmin.config.get = function(callback, sessionData) {
meta.configs.list(function(err, config) {
if (!err) {
callback(config);
}
});
};
SocketAdmin.config.set = function(data, callback, sessionData) {
meta.configs.set(data.key, data.value, function(err) {
if (!err) {
callback({
status: 'ok'
});
plugins.fireHook('action:config.set', {
key: data.key,
value: data.value
});
}
logger.monitorConfig({io: sessionData.server}, data);
});
};
SocketAdmin.config.remove = function(key) {
meta.configs.remove(key);
};
module.exports = SocketAdmin; module.exports = SocketAdmin;

@ -96,39 +96,6 @@ SocketMeta.rooms.getAll = function(callback, sessionData) {
callback(sessionData.server.sockets.manager.rooms); callback(sessionData.server.sockets.manager.rooms);
}; };
/* Config */
SocketMeta.config = {};
SocketMeta.config.get = function(callback, sessionData) {
meta.configs.list(function(err, config) {
if (!err) {
callback(config);
}
});
};
SocketMeta.config.set = function(data, callback, sessionData) {
meta.configs.set(data.key, data.value, function(err) {
if (!err) {
callback({
status: 'ok'
});
plugins.fireHook('action:config.set', {
key: data.key,
value: data.value
});
}
logger.monitorConfig({io: sessionData.server}, data);
});
};
SocketMeta.config.remove = function(key) {
meta.configs.remove(key);
};
/* Exports */ /* Exports */
module.exports = SocketMeta; module.exports = SocketMeta;
Loading…
Cancel
Save