get sort setting from config

v1.18.x
barisusakli 9 years ago
parent 240682563d
commit 7afd2925af

@ -277,7 +277,8 @@ define('forum/category', [
cid: ajaxify.data.cid,
after: after,
direction: direction,
author: utils.params().author
author: utils.params().author,
categoryTopicSort: config.categoryTopicSort
}, function (data, done) {
if (data.topics && data.topics.length) {
Category.onTopicsLoaded(data, direction, done);

@ -222,7 +222,8 @@ define('forum/topic/posts', [
infinitescroll.loadMore('topics.loadMore', {
tid: tid,
after: after,
direction: direction
direction: direction,
topicPostSort: config.topicPostSort
}, function (data, done) {
indicatorEl.fadeOut();

@ -80,12 +80,12 @@ SocketCategories.loadMore = function(socket, data, callback) {
}
var infScrollTopicsPerPage = 20;
var set = 'cid:' + data.cid + ':tids',
reverse = false;
var set = 'cid:' + data.cid + ':tids';
var reverse = false;
if (results.settings.categoryTopicSort === 'newest_to_oldest') {
if (data.categoryTopicSort === 'newest_to_oldest') {
reverse = true;
} else if (results.settings.categoryTopicSort === 'most_posts') {
} else if (data.categoryTopicSort === 'most_posts') {
reverse = true;
set = 'cid:' + data.cid + ':tids:posts';
}

@ -1,7 +1,7 @@
'use strict';
var async = require('async');
var user = require('../../user');
var topics = require('../../topics');
var privileges = require('../../privileges');
var meta = require('../../meta');
@ -19,9 +19,6 @@ module.exports = function(SocketTopics) {
privileges: function(next) {
privileges.topics.get(data.tid, socket.uid, next);
},
settings: function(next) {
user.getSettings(socket.uid, next);
},
topic: function(next) {
topics.getTopicFields(data.tid, ['postcount', 'deleted'], next);
}
@ -35,10 +32,10 @@ module.exports = function(SocketTopics) {
}
var set = 'tid:' + data.tid + ':posts';
if (results.settings.topicPostSort === 'most_votes') {
if (data.topicPostSort === 'most_votes') {
set = 'tid:' + data.tid + ':posts:votes';
}
var reverse = results.settings.topicPostSort === 'newest_to_oldest' || results.settings.topicPostSort === 'most_votes';
var reverse = data.topicPostSort === 'newest_to_oldest' || data.topicPostSort === 'most_votes';
var start = Math.max(0, parseInt(data.after, 10));
var infScrollPostsPerPage = 10;

Loading…
Cancel
Save