reset number of posts to fetch on channel switch and fresh page load
Этот коммит содержится в:
@@ -272,17 +272,20 @@ module.exports.search = function(terms) {
|
||||
);
|
||||
}
|
||||
|
||||
module.exports.getPosts = function(force, id) {
|
||||
module.exports.getPosts = function(force, id, maxPosts) {
|
||||
if (PostStore.getCurrentPosts() == null || force) {
|
||||
var channelId = id ? id : ChannelStore.getCurrentId();
|
||||
|
||||
if (isCallInProgress("getPosts_"+channelId)) return;
|
||||
|
||||
var post_list = PostStore.getCurrentPosts();
|
||||
|
||||
if (!maxPosts) { maxPosts = Constants.POST_CHUNK_SIZE * Constants.MAX_POST_CHUNKS };
|
||||
|
||||
// if we already have more than POST_CHUNK_SIZE posts,
|
||||
// let's get the amount we have but rounded up to next multiple of POST_CHUNK_SIZE,
|
||||
// with a max at 180
|
||||
var numPosts = post_list && post_list.order.length > 0 ? Math.min(180, Constants.POST_CHUNK_SIZE * Math.ceil(post_list.order.length / Constants.POST_CHUNK_SIZE)) : Constants.POST_CHUNK_SIZE;
|
||||
// with a max at maxPosts
|
||||
var numPosts = post_list && post_list.order.length > 0 ? Math.min(maxPosts, Constants.POST_CHUNK_SIZE * Math.ceil(post_list.order.length / Constants.POST_CHUNK_SIZE)) : Constants.POST_CHUNK_SIZE;
|
||||
|
||||
if (channelId != null) {
|
||||
callTracker["getPosts_"+channelId] = utils.getTimestamp();
|
||||
|
||||
Ссылка в новой задаче
Block a user