Merge remote-tracking branch 'refs/remotes/origin/master' into develop

This commit is contained in:
Barış Soner Uşaklı
2017-08-18 20:09:40 -04:00
21 changed files with 100 additions and 54 deletions

View File

@@ -166,6 +166,7 @@ module.exports = function (User) {
var data = JSON.parse(note);
uids.push(data.uid);
data.timestampISO = utils.toISOString(data.timestamp);
data.note = validator.escape(String(data.note));
return data;
} catch (err) {
return next(err);

View File

@@ -185,7 +185,9 @@ module.exports = function (User) {
function (next) {
db.sortedSetAdd('users:notvalidated', Date.now(), uid, next);
},
async.apply(User.reset.cleanByUid, uid),
function (next) {
User.reset.cleanByUid(uid, next);
},
], function (err) {
next(err);
});

View File

@@ -170,17 +170,12 @@ UserReset.clean = function (callback) {
};
UserReset.cleanByUid = function (uid, callback) {
if (typeof callback !== 'function') {
callback = function () {};
}
var toClean = [];
uid = parseInt(uid, 10);
async.waterfall([
async.apply(db.getSortedSetRange.bind(db), 'reset:issueDate', 0, -1),
function (tokens, next) {
batch.processArray(tokens, function (tokens, next) {
function (next) {
batch.processSortedSet('reset:issueDate', function (tokens, next) {
db.getObjectFields('reset:uid', tokens, function (err, results) {
for (var code in results) {
if (results.hasOwnProperty(code) && parseInt(results[code], 10) === uid) {