From 55e9358f74d7b4fb080049d80230d2b8beb3de3c Mon Sep 17 00:00:00 2001 From: Phasakorn Chivatxaranukul <61149119+pskodr@users.noreply.github.com> Date: Thu, 12 Mar 2026 14:25:52 +0000 Subject: [PATCH 1/3] task-1a --- src/posts/topics.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/posts/topics.js b/src/posts/topics.js index 7f0fe31e4f..6d30e2f096 100644 --- a/src/posts/topics.js +++ b/src/posts/topics.js @@ -1,4 +1,3 @@ - 'use strict'; const topics = require('../topics'); @@ -6,7 +5,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 }) { const pids = await Posts.getPidsFromSet(set, start, stop, reverse); const posts = await Posts.getPostsByPids(pids, uid); return await user.blocks.filter(uid, posts); @@ -52,4 +51,4 @@ module.exports = function (Posts) { return paths; }; -}; +}; \ No newline at end of file From d70ac092f3f366d8380c33a00229fabadfeade6c Mon Sep 17 00:00:00 2001 From: Phasakorn Chivatxaranukul <61149119+pskodr@users.noreply.github.com> Date: Thu, 12 Mar 2026 14:31:57 +0000 Subject: [PATCH 2/3] task-1b --- src/posts/topics.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/posts/topics.js b/src/posts/topics.js index 6d30e2f096..55e67ba585 100644 --- a/src/posts/topics.js +++ b/src/posts/topics.js @@ -1,3 +1,4 @@ + 'use strict'; const topics = require('../topics'); @@ -51,4 +52,4 @@ module.exports = function (Posts) { return paths; }; -}; \ No newline at end of file +}; From e8e1ed30e73de8fcdab0eee3ffc8b11dbde55fcd Mon Sep 17 00:00:00 2001 From: Phasakorn Chivatxaranukul <61149119+pskodr@users.noreply.github.com> Date: Thu, 12 Mar 2026 14:35:03 +0000 Subject: [PATCH 3/3] task-1c, after review changes --- src/posts/topics.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/posts/topics.js b/src/posts/topics.js index 55e67ba585..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; });