mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-15 03:52:46 +01:00
use same settings for spiders
This commit is contained in:
@@ -10,11 +10,16 @@ const notifications = require('../notifications');
|
||||
const languages = require('../languages');
|
||||
|
||||
module.exports = function (User) {
|
||||
const spiderDefaultSettings = {
|
||||
usePagination: 1,
|
||||
topicPostSort: 'oldest_to_newest',
|
||||
postsPerPage: 20,
|
||||
topicsPerPage: 20,
|
||||
};
|
||||
User.getSettings = async function (uid) {
|
||||
if (parseInt(uid, 10) <= 0) {
|
||||
return await onSettingsLoaded(uid, {
|
||||
usePagination: parseInt(uid, 10) === -1 ? 1 : undefined, // force spiders to use pagination
|
||||
});
|
||||
const isSpider = parseInt(uid, 10) === -1;
|
||||
return await onSettingsLoaded(uid, isSpider ? spiderDefaultSettings : {});
|
||||
}
|
||||
let settings = await db.getObject(`user:${uid}:settings`);
|
||||
settings = settings || {};
|
||||
|
||||
Reference in New Issue
Block a user