mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: 'unread' postIndex regression closes #10607
This commit is contained in:
@@ -58,12 +58,12 @@ topicsController.get = async function getTopic(req, res, next) {
|
||||
return helpers.notAllowed(req, res);
|
||||
}
|
||||
|
||||
if (!res.locals.isAPI && (!req.params.slug || topicData.slug !== `${tid}/${req.params.slug}`) && (topicData.slug && topicData.slug !== `${tid}/`)) {
|
||||
return helpers.redirect(res, `/topic/${topicData.slug}${postIndex ? `/${postIndex}` : ''}${generateQueryString(req.query)}`, true);
|
||||
if (req.params.post_index === 'unread') {
|
||||
postIndex = await topics.getUserBookmark(tid, req.uid);
|
||||
}
|
||||
|
||||
if (postIndex === 'unread') {
|
||||
postIndex = await topics.getUserBookmark(tid, req.uid);
|
||||
if (!res.locals.isAPI && (!req.params.slug || topicData.slug !== `${tid}/${req.params.slug}`) && (topicData.slug && topicData.slug !== `${tid}/`)) {
|
||||
return helpers.redirect(res, `/topic/${topicData.slug}${postIndex ? `/${postIndex}` : ''}${generateQueryString(req.query)}`, true);
|
||||
}
|
||||
|
||||
if (utils.isNumber(postIndex) && topicData.postcount > 0 && (postIndex < 1 || postIndex > topicData.postcount)) {
|
||||
|
||||
Reference in New Issue
Block a user