feat: small fixes

This commit is contained in:
Barış Soner Uşaklı
2018-12-17 18:56:09 -05:00
parent b2a74b4172
commit fef7e13c9e
8 changed files with 34 additions and 20 deletions

View File

@@ -188,13 +188,15 @@ Topics.getTopicWithPosts = function (topicData, set, uid, start, stop, reverse,
topicData.bookmark = results.bookmark;
topicData.postSharing = results.postSharing;
topicData.deleter = results.deleter;
topicData.deletedTimestampISO = utils.toISOString(topicData.deletedTimestamp);
if (results.deleter) {
topicData.deletedTimestampISO = utils.toISOString(topicData.deletedTimestamp);
}
topicData.merger = results.merger;
topicData.mergedTimestampISO = utils.toISOString(topicData.mergedTimestamp);
if (results.merger) {
topicData.mergedTimestampISO = utils.toISOString(topicData.mergedTimestamp);
}
topicData.related = results.related || [];
topicData.unreplied = topicData.postcount === 1;
topicData.icons = [];
plugins.fireHook('filter:topic.get', { topic: topicData, uid: uid }, next);
@@ -245,14 +247,14 @@ function getMainPostAndReplies(topic, set, uid, start, stop, reverse, callback)
}
function getDeleter(topicData, callback) {
if (!topicData.deleterUid) {
if (!parseInt(topicData.deleterUid, 10)) {
return setImmediate(callback, null, null);
}
user.getUserFields(topicData.deleterUid, ['username', 'userslug', 'picture'], callback);
}
function getMerger(topicData, callback) {
if (!topicData.mergerUid) {
if (!parseInt(topicData.mergerUid, 10)) {
return setImmediate(callback, null, null);
}
async.waterfall([