mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-30 20:30:32 +01:00
Compare commits
4 Commits
v1.17.2-be
...
v1.17.2-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bad359f308 | ||
|
|
51b3bb4481 | ||
|
|
00c6ddfdaf | ||
|
|
e4344d31d9 |
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const nconf = require('nconf');
|
||||
const qs = require('querystring');
|
||||
|
||||
const user = require('../user');
|
||||
const meta = require('../meta');
|
||||
@@ -58,7 +59,7 @@ topicsController.get = async function getTopic(req, res, callback) {
|
||||
}
|
||||
|
||||
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}` : ''}${currentPage > 1 ? `?page=${currentPage}` : ''}`, true);
|
||||
return helpers.redirect(res, `/topic/${topicData.slug}${postIndex ? `/${postIndex}` : ''}${generateQueryString(req.query)}`, true);
|
||||
}
|
||||
|
||||
if (postIndex === 'unread') {
|
||||
@@ -66,7 +67,7 @@ topicsController.get = async function getTopic(req, res, callback) {
|
||||
}
|
||||
|
||||
if (utils.isNumber(postIndex) && topicData.postcount > 0 && (postIndex < 1 || postIndex > topicData.postcount)) {
|
||||
return helpers.redirect(res, `/topic/${req.params.topic_id}/${req.params.slug}${postIndex > topicData.postcount ? `/${topicData.postcount}` : ''}`);
|
||||
return helpers.redirect(res, `/topic/${tid}/${req.params.slug}${postIndex > topicData.postcount ? `/${topicData.postcount}` : ''}${generateQueryString(req.query)}`);
|
||||
}
|
||||
postIndex = Math.max(1, postIndex);
|
||||
const sort = req.query.sort || settings.topicPostSort;
|
||||
@@ -120,6 +121,11 @@ topicsController.get = async function getTopic(req, res, callback) {
|
||||
res.render('topic', topicData);
|
||||
};
|
||||
|
||||
function generateQueryString(query) {
|
||||
const qString = qs.stringify(query);
|
||||
return qString.length ? `?${qString}` : '';
|
||||
}
|
||||
|
||||
function calculatePageFromIndex(postIndex, settings) {
|
||||
return 1 + Math.floor((postIndex - 1) / settings.postsPerPage);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ module.exports = function (User) {
|
||||
throw new Error('[[error:no-user]]');
|
||||
}
|
||||
|
||||
await plugins.hooks.fire('static:user.delete', { uid: uid });
|
||||
await plugins.hooks.fire('static:user.delete', { uid: uid, userData: userData });
|
||||
await deleteVotes(uid);
|
||||
await deleteChats(uid);
|
||||
await User.auth.revokeAllSessions(uid);
|
||||
|
||||
Reference in New Issue
Block a user