mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
refactor: change var name
This commit is contained in:
@@ -21,8 +21,8 @@ module.exports = function (Topics) {
|
|||||||
await Topics.addPostToTopic(postData.tid, postData);
|
await Topics.addPostToTopic(postData.tid, postData);
|
||||||
};
|
};
|
||||||
|
|
||||||
Topics.getTopicPosts = async function (topicOrTid, set, start, stop, uid, reverse) {
|
Topics.getTopicPosts = async function (topicData, set, start, stop, uid, reverse) {
|
||||||
if (!topicOrTid) {
|
if (!topicData) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,28 +38,28 @@ module.exports = function (Topics) {
|
|||||||
if (start !== 0 || stop !== 0) {
|
if (start !== 0 || stop !== 0) {
|
||||||
pids = await posts.getPidsFromSet(set, repliesStart, repliesStop, reverse);
|
pids = await posts.getPidsFromSet(set, repliesStart, repliesStop, reverse);
|
||||||
}
|
}
|
||||||
if (!pids.length && !topicOrTid.mainPid) {
|
if (!pids.length && !topicData.mainPid) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topicOrTid.mainPid && start === 0) {
|
if (topicData.mainPid && start === 0) {
|
||||||
pids.unshift(topicOrTid.mainPid);
|
pids.unshift(topicData.mainPid);
|
||||||
}
|
}
|
||||||
const postData = await posts.getPostsByPids(pids, uid);
|
const postData = await posts.getPostsByPids(pids, uid);
|
||||||
if (!postData.length) {
|
if (!postData.length) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
let replies = postData;
|
let replies = postData;
|
||||||
if (topicOrTid.mainPid && start === 0) {
|
if (topicData.mainPid && start === 0) {
|
||||||
postData[0].index = 0;
|
postData[0].index = 0;
|
||||||
replies = postData.slice(1);
|
replies = postData.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Topics.calculatePostIndices(replies, repliesStart);
|
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', {
|
const result = await plugins.hooks.fire('filter:topic.getPosts', {
|
||||||
topic: topicOrTid,
|
topic: topicData,
|
||||||
uid: uid,
|
uid: uid,
|
||||||
posts: await Topics.addPostData(postData, uid),
|
posts: await Topics.addPostData(postData, uid),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user