v1.18.x
Barış Soner Uşaklı 8 years ago
parent 3d1b1a9423
commit 8e31ec7199

@ -342,6 +342,7 @@ Flags.create = function (type, id, uid, reason, timestamp, callback) {
tasks.push(async.apply(db.sortedSetAdd.bind(db), 'flags:byPid:' + id, timestamp, flagId)); // by target pid
if (targetUid) {
tasks.push(async.apply(db.sortedSetIncrBy.bind(db), 'users:flags', 1, targetUid));
tasks.push(async.apply(user.incrementUserFieldBy, targetUid, 'flags', 1));
}
}
@ -543,19 +544,16 @@ Flags.getHistory = function (flagId, callback) {
user.getUsersFields(uids, ['username', 'userslug', 'picture'], next);
},
], function (err, users) {
if (err) {
return callback(err);
}
// Append user data to each history event
history = history.map(function (event, idx) {
event.user = users[idx];
return event;
});
function (users, next) {
// Append user data to each history event
history = history.map(function (event, idx) {
event.user = users[idx];
return event;
});
callback(null, history);
});
next(null, history);
},
], callback);
};
Flags.appendHistory = function (flagId, uid, changeset, callback) {

Loading…
Cancel
Save