|
|
|
@ -135,12 +135,14 @@ module.exports = function (User) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
User.saveSettings = function (uid, data, callback) {
|
|
|
|
|
if (!data.postsPerPage || parseInt(data.postsPerPage, 10) <= 1 || parseInt(data.postsPerPage, 10) > meta.config.postsPerPage) {
|
|
|
|
|
return callback(new Error('[[error:invalid-pagination-value, 2, ' + meta.config.postsPerPage + ']]'));
|
|
|
|
|
var maxPostsPerPage = meta.config.maxPostsPerPage || 20;
|
|
|
|
|
if (!data.postsPerPage || parseInt(data.postsPerPage, 10) <= 1 || parseInt(data.postsPerPage, 10) > maxPostsPerPage) {
|
|
|
|
|
return callback(new Error('[[error:invalid-pagination-value, 2, ' + maxPostsPerPage + ']]'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!data.topicsPerPage || parseInt(data.topicsPerPage, 10) <= 1 || parseInt(data.topicsPerPage, 10) > meta.config.topicsPerPage) {
|
|
|
|
|
return callback(new Error('[[error:invalid-pagination-value, 2, ' + meta.config.topicsPerPage + ']]'));
|
|
|
|
|
var maxTopicsPerPage = meta.config.maxTopicsPerPage || 20;
|
|
|
|
|
if (!data.topicsPerPage || parseInt(data.topicsPerPage, 10) <= 1 || parseInt(data.topicsPerPage, 10) > maxTopicsPerPage) {
|
|
|
|
|
return callback(new Error('[[error:invalid-pagination-value, 2, ' + maxTopicsPerPage + ']]'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.userLang = data.userLang || meta.config.defaultLang;
|
|
|
|
@ -153,8 +155,8 @@ module.exports = function (User) {
|
|
|
|
|
openOutgoingLinksInNewTab: data.openOutgoingLinksInNewTab,
|
|
|
|
|
dailyDigestFreq: data.dailyDigestFreq || 'off',
|
|
|
|
|
usePagination: data.usePagination,
|
|
|
|
|
topicsPerPage: Math.min(data.topicsPerPage, parseInt(meta.config.topicsPerPage, 10) || 20),
|
|
|
|
|
postsPerPage: Math.min(data.postsPerPage, parseInt(meta.config.postsPerPage, 10) || 20),
|
|
|
|
|
topicsPerPage: Math.min(data.topicsPerPage, parseInt(maxTopicsPerPage, 10) || 20),
|
|
|
|
|
postsPerPage: Math.min(data.postsPerPage, parseInt(maxPostsPerPage, 10) || 20),
|
|
|
|
|
userLang: data.userLang || meta.config.defaultLang,
|
|
|
|
|
followTopicsOnCreate: data.followTopicsOnCreate,
|
|
|
|
|
followTopicsOnReply: data.followTopicsOnReply,
|
|
|
|
|