diff --git a/src/posts/topics.js b/src/posts/topics.js index 7f0fe31e4f..2c034a017a 100644 --- a/src/posts/topics.js +++ b/src/posts/topics.js @@ -6,7 +6,7 @@ const user = require('../user'); const utils = require('../utils'); module.exports = function (Posts) { - Posts.getPostsFromSet = async function (set, start, stop, uid, reverse) { + Posts.getPostsFromSet = async function ({ set, start, stop, uid, reverse = false }) { const pids = await Posts.getPidsFromSet(set, start, stop, reverse); const posts = await Posts.getPostsByPids(pids, uid); return await user.blocks.filter(uid, posts); @@ -44,8 +44,8 @@ module.exports = function (Posts) { const postIndex = utils.isNumber(indices[index]) ? parseInt(indices[index], 10) + 1 : null; if (slug && postIndex) { - const index = postIndex === 1 ? '' : `/${postIndex}`; - return `/topic/${slug}${index}`; + const postIndexSuffix = postIndex === 1 ? '' : `/${postIndex}`; + return `/topic/${slug}${postIndexSuffix}`; } return null; });