diff --git a/src/meta/settings.js b/src/meta/settings.js index 18eae100c3..d157a4cd95 100644 --- a/src/meta/settings.js +++ b/src/meta/settings.js @@ -36,7 +36,9 @@ Settings.set = function (hash, values, 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) { @@ -54,7 +56,7 @@ Settings.setOnEmpty = function (hash, values, callback) { }); if (Object.keys(empty).length) { - db.setObject('settings:' + hash, empty, next); + Settings.set(hash, empty, next); } else { next(); } diff --git a/src/socket.io/admin.js b/src/socket.io/admin.js index bae1832782..df169aba0e 100644 --- a/src/socket.io/admin.js +++ b/src/socket.io/admin.js @@ -187,7 +187,10 @@ SocketAdmin.config.setMultiple = function (socket, data, callback) { 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); }; @@ -201,7 +204,19 @@ SocketAdmin.settings.get = 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) {