Compare commits

...

3 Commits

Author SHA1 Message Date
Barış Soner Uşaklı
291df36c3d backport crash fix 2017-05-09 14:33:19 -04:00
Barış Soner Uşaklı
3b626f74b4 backport paste image fix 2017-05-09 13:26:00 -04:00
Barış Soner Uşaklı
ca0ab7633f backport cache fix 2017-05-08 21:35:35 -04:00
3 changed files with 9 additions and 7 deletions

View File

@@ -54,7 +54,7 @@
"morgan": "^1.3.2",
"mousetrap": "^1.5.3",
"nconf": "~0.8.2",
"nodebb-plugin-composer-default": "4.4.6",
"nodebb-plugin-composer-default": "4.4.7",
"nodebb-plugin-dbsearch": "2.0.2",
"nodebb-plugin-emoji-extended": "1.1.1",
"nodebb-plugin-emoji-one": "1.1.5",

View File

@@ -15,7 +15,7 @@ var utils = require('../public/src/utils');
var _ = require('underscore');
var S = require('string');
var Flags = {};
var Flags = module.exports;
Flags.get = function (flagId, callback) {
async.waterfall([
@@ -26,6 +26,9 @@ Flags.get = function (flagId, callback) {
notes: async.apply(Flags.getNotes, flagId),
}),
function (data, next) {
if (!data.base) {
return callback();
}
// Second stage
async.parallel({
userObj: async.apply(user.getUserFields, data.base.uid, ['username', 'userslug', 'picture']),
@@ -682,5 +685,3 @@ Flags.notify = function (flagObj, uid, callback) {
break;
}
};
module.exports = Flags;

View File

@@ -2,6 +2,7 @@
'use strict';
var async = require('async');
var _ = require('underscore');
var meta = require('../meta');
var db = require('../database');
@@ -25,7 +26,7 @@ module.exports = function (User) {
var cached = cache.get('user:' + uid + ':settings');
if (cached) {
return onSettingsLoaded(uid, cached || {}, callback);
return onSettingsLoaded(uid, _.clone(cached || {}), callback);
}
async.waterfall([
@@ -36,7 +37,7 @@ module.exports = function (User) {
settings = settings || {};
settings.uid = uid;
cache.set('user:' + uid + ':settings', settings);
onSettingsLoaded(uid, settings || {}, next);
onSettingsLoaded(uid, _.clone(settings || {}), next);
},
], callback);
};
@@ -47,7 +48,7 @@ module.exports = function (User) {
return cache.get('user:' + uid + ':settings') || {};
});
async.map(settings, function (setting, next) {
onSettingsLoaded(setting.uid, setting, next);
onSettingsLoaded(setting.uid, _.clone(setting), next);
}, next);
}