fix: 'unread' postIndex regression closes #10607

isekai-main
Barış Soner Uşaklı 3 years ago
parent 70ad4a5222
commit 0e60a704a5

@ -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)) {

Loading…
Cancel
Save