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);
});
socket.emit('api:meta.config.get', function(config) {
socket.emit('api:admin.config.get', function(config) {
app.config = config;
});

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

@ -1,9 +1,13 @@
"use strict";
var groups = require('../groups'),
meta = require('../meta'),
plugins = require('../plugins'),
user = require('../user'),
topics = require('../topics'),
categories = require('../categories'),
CategoryTools = require('../categoryTools'),
logger = require('../logger'),
admin = {
user: require('../admin/user'),
categories: require('../admin/categories')
@ -133,13 +137,19 @@ SocketAdmin.categories.search = function(username, cid, callback, sessionData) {
next(null, userObj);
});
}, function(err, data) {
if (!callback) sessionData.socket.emit('api:admin.categories.search', data);
else callback(null, data);
if (!callback) {
sessionData.socket.emit('api:admin.categories.search', data);
} else {
callback(null, data);
}
});
});
} else {
if (!callback) sessionData.socket.emit('api:admin.user.search', null);
else callback();
if (!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;

@ -96,39 +96,6 @@ SocketMeta.rooms.getAll = function(callback, sessionData) {
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 */
module.exports = SocketMeta;
Loading…
Cancel
Save