diff --git a/package.json b/package.json index fa98569cef..5a93cb7177 100644 --- a/package.json +++ b/package.json @@ -61,9 +61,9 @@ "nodebb-plugin-spam-be-gone": "0.4.10", "nodebb-rewards-essentials": "0.0.9", "nodebb-theme-lavender": "3.0.14", - "nodebb-theme-persona": "4.1.58", - "nodebb-theme-vanilla": "5.1.39", - "nodebb-widget-essentials": "2.0.11", + "nodebb-theme-persona": "4.1.59", + "nodebb-theme-vanilla": "5.1.40", + "nodebb-widget-essentials": "2.0.12", "nodemailer": "2.0.0", "nodemailer-sendmail-transport": "1.0.0", "nodemailer-smtp-transport": "^2.4.1", diff --git a/src/posts/summary.js b/src/posts/summary.js index b40eeb1b40..31a82b340f 100644 --- a/src/posts/summary.js +++ b/src/posts/summary.js @@ -50,9 +50,6 @@ module.exports = function(Posts) { }, topicsAndCategories: function(next) { getTopicAndCategories(topicKeys, next); - }, - indices: function(next) { - Posts.getPostIndices(posts, uid, next); } }, next); }, @@ -61,13 +58,7 @@ module.exports = function(Posts) { results.topics = toObject('tid', results.topicsAndCategories.topics); results.categories = toObject('cid', results.topicsAndCategories.categories); - posts.forEach(function(post, i) { - post.index = utils.isNumber(results.indices[i]) ? parseInt(results.indices[i], 10) + 1 : 1; - post.isMainPost = post.index - 1 === 0; - post.deleted = parseInt(post.deleted, 10) === 1; - post.upvotes = parseInt(post.upvotes, 10) || 0; - post.downvotes = parseInt(post.downvotes, 10) || 0; - post.votes = post.upvotes - post.downvotes; + posts.forEach(function(post) { // If the post author isn't represented in the retrieved users' data, then it means they were deleted, assume guest. if (!results.users.hasOwnProperty(post.uid)) { post.uid = 0; @@ -75,6 +66,11 @@ module.exports = function(Posts) { post.user = results.users[post.uid]; post.topic = results.topics[post.tid]; post.category = results.categories[post.topic.cid]; + post.isMainPost = parseInt(post.pid, 10) === parseInt(post.topic.mainPid, 10); + post.deleted = parseInt(post.deleted, 10) === 1; + post.upvotes = parseInt(post.upvotes, 10) || 0; + post.downvotes = parseInt(post.downvotes, 10) || 0; + post.votes = post.upvotes - post.downvotes; post.timestampISO = utils.toISOString(post.timestamp); }); @@ -117,7 +113,7 @@ module.exports = function(Posts) { } function getTopicAndCategories(topicKeys, callback) { - db.getObjectsFields(topicKeys, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted', 'postcount'], function(err, topics) { + db.getObjectsFields(topicKeys, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted', 'postcount', 'mainPid'], function(err, topics) { if (err) { return callback(err); } diff --git a/src/routes/feeds.js b/src/routes/feeds.js index 3ceefbb4d6..9775f9c99f 100644 --- a/src/routes/feeds.js +++ b/src/routes/feeds.js @@ -77,7 +77,7 @@ function generateForTopic(req, res, callback) { feed.item({ title: 'Reply to ' + topicData.title + ' on ' + dateStamp, description: postData.content, - url: nconf.get('url') + '/topic/' + topicData.slug + (postData.index ? '/' + (postData.index + 1) : ''), + url: nconf.get('url') + '/post/' + postData.pid, author: postData.user ? postData.user.username : '', date: dateStamp }); @@ -350,7 +350,7 @@ function generateForPostsFeed(feedOptions, posts) { feed.item({ title: postData.topic ? postData.topic.title : '', description: postData.content, - url: nconf.get('url') + '/topic/' + (postData.topic ? postData.topic.slug : '#') + '/'+postData.index, + url: nconf.get('url') + '/post/' + postData.pid, author: postData.user ? postData.user.username : '', date: new Date(parseInt(postData.timestamp, 10)).toUTCString() }); diff --git a/src/views/admin/manage/flags.tpl b/src/views/admin/manage/flags.tpl index dccc3ae46f..4956b953e8 100644 --- a/src/views/admin/manage/flags.tpl +++ b/src/views/admin/manage/flags.tpl @@ -98,7 +98,7 @@ Posted in {posts.category.name}, • - Read More + Read More