v1.18.x
Baris Usakli 8 years ago
parent a509ccab84
commit cf444755df

@ -36,7 +36,9 @@ Settings.set = function (hash, values, callback) {
}; };
Settings.setOne = function (hash, field, value, callback) { Settings.setOne = function (hash, field, value, callback) {
db.setObjectField('settings:' + hash, field, value, callback); var data = {};
data[field] = value;
Settings.set(hash, data, callback);
}; };
Settings.setOnEmpty = function (hash, values, callback) { Settings.setOnEmpty = function (hash, values, callback) {
@ -54,7 +56,7 @@ Settings.setOnEmpty = function (hash, values, callback) {
}); });
if (Object.keys(empty).length) { if (Object.keys(empty).length) {
db.setObject('settings:' + hash, empty, next); Settings.set(hash, empty, next);
} else { } else {
next(); next();
} }

@ -187,7 +187,10 @@ SocketAdmin.config.setMultiple = function (socket, data, callback) {
logger.monitorConfig({ io: index.server }, setting); logger.monitorConfig({ io: index.server }, setting);
} }
} }
setImmediate(next); data.type = 'config-change';
data.uid = socket.uid;
data.ip = socket.ip;
events.log(data, next);
}, },
], callback); ], callback);
}; };
@ -201,7 +204,19 @@ SocketAdmin.settings.get = function (socket, data, callback) {
}; };
SocketAdmin.settings.set = function (socket, data, callback) { SocketAdmin.settings.set = function (socket, data, callback) {
meta.settings.set(data.hash, data.values, callback); async.waterfall([
function (next) {
meta.settings.set(data.hash, data.values, next);
},
function (next) {
var eventData = data.values;
eventData.type = 'settings-change';
eventData.uid = socket.uid;
eventData.ip = socket.ip;
eventData.hash = data.hash;
events.log(eventData, next);
},
], callback);
}; };
SocketAdmin.settings.clearSitemapCache = function (socket, data, callback) { SocketAdmin.settings.clearSitemapCache = function (socket, data, callback) {

Loading…
Cancel
Save