mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: if reply is in different topic dont hide in parent
This commit is contained in:
@@ -342,7 +342,7 @@ module.exports = function (Topics) {
|
|||||||
const postDataMap = _.zipObject(pids, postData);
|
const postDataMap = _.zipObject(pids, postData);
|
||||||
|
|
||||||
const returnData = await Promise.all(arrayOfReplyPids.map(async (replyPids, idx) => {
|
const returnData = await Promise.all(arrayOfReplyPids.map(async (replyPids, idx) => {
|
||||||
const currentPid = pids[idx];
|
const currentPost = postData[idx];
|
||||||
replyPids = replyPids.filter(pid => pidMap[pid]);
|
replyPids = replyPids.filter(pid => pidMap[pid]);
|
||||||
const uidsUsed = {};
|
const uidsUsed = {};
|
||||||
const currentData = {
|
const currentData = {
|
||||||
@@ -370,7 +370,7 @@ module.exports = function (Topics) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (replyPids.length === 1) {
|
if (replyPids.length === 1) {
|
||||||
const currentIndex = postDataMap[currentPid] ? postDataMap[currentPid].index : null;
|
const currentIndex = currentPost ? currentPost.index : null;
|
||||||
const replyPid = replyPids[0];
|
const replyPid = replyPids[0];
|
||||||
// only load index of nested reply if we can't find it in the postDataMap
|
// only load index of nested reply if we can't find it in the postDataMap
|
||||||
let replyPost = postDataMap[replyPid];
|
let replyPost = postDataMap[replyPid];
|
||||||
@@ -378,9 +378,12 @@ module.exports = function (Topics) {
|
|||||||
const tid = await posts.getPostField(replyPid, 'tid');
|
const tid = await posts.getPostField(replyPid, 'tid');
|
||||||
replyPost = {
|
replyPost = {
|
||||||
index: await posts.getPidIndex(replyPid, tid, userSettings.topicPostSort),
|
index: await posts.getPidIndex(replyPid, tid, userSettings.topicPostSort),
|
||||||
|
tid: tid,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
currentData.hasSingleImmediateReply = Math.abs(currentIndex - replyPost.index) === 1;
|
currentData.hasSingleImmediateReply =
|
||||||
|
(currentPost && currentPost.tid === replyPost.tid) &&
|
||||||
|
Math.abs(currentIndex - replyPost.index) === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentData;
|
return currentData;
|
||||||
|
|||||||
Reference in New Issue
Block a user