From 36eb47d9a0b4cb1b5d6b6c30be39fb1420c59b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 6 Dec 2021 17:00:50 -0500 Subject: [PATCH] refactor: change var name --- src/topics/posts.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/topics/posts.js b/src/topics/posts.js index c83c743e95..b66ed0eb83 100644 --- a/src/topics/posts.js +++ b/src/topics/posts.js @@ -21,8 +21,8 @@ module.exports = function (Topics) { await Topics.addPostToTopic(postData.tid, postData); }; - Topics.getTopicPosts = async function (topicOrTid, set, start, stop, uid, reverse) { - if (!topicOrTid) { + Topics.getTopicPosts = async function (topicData, set, start, stop, uid, reverse) { + if (!topicData) { return []; } @@ -38,28 +38,28 @@ module.exports = function (Topics) { if (start !== 0 || stop !== 0) { pids = await posts.getPidsFromSet(set, repliesStart, repliesStop, reverse); } - if (!pids.length && !topicOrTid.mainPid) { + if (!pids.length && !topicData.mainPid) { return []; } - if (topicOrTid.mainPid && start === 0) { - pids.unshift(topicOrTid.mainPid); + if (topicData.mainPid && start === 0) { + pids.unshift(topicData.mainPid); } const postData = await posts.getPostsByPids(pids, uid); if (!postData.length) { return []; } let replies = postData; - if (topicOrTid.mainPid && start === 0) { + if (topicData.mainPid && start === 0) { postData[0].index = 0; replies = postData.slice(1); } Topics.calculatePostIndices(replies, repliesStart); - await addEventStartEnd(postData, set, reverse, topicOrTid); + await addEventStartEnd(postData, set, reverse, topicData); const result = await plugins.hooks.fire('filter:topic.getPosts', { - topic: topicOrTid, + topic: topicData, uid: uid, posts: await Topics.addPostData(postData, uid), });