finalize implenetation of predictive client posts so that users get immediate feedback after posting
Этот коммит содержится в:
@@ -346,24 +346,33 @@ module.exports.search = function(terms) {
|
||||
|
||||
module.exports.getPosts = function(force, id, maxPosts) {
|
||||
if (PostStore.getCurrentPosts() == null || force) {
|
||||
var channelId = id ? id : ChannelStore.getCurrentId();
|
||||
var channelId = id;
|
||||
if (channelId == null) {
|
||||
channelId = ChannelStore.getCurrentId();
|
||||
}
|
||||
|
||||
if (isCallInProgress('getPosts_'+channelId)) return;
|
||||
if (isCallInProgress('getPosts_' + channelId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var post_list = PostStore.getCurrentPosts();
|
||||
var postList = PostStore.getCurrentPosts();
|
||||
|
||||
if (!maxPosts) { maxPosts = Constants.POST_CHUNK_SIZE * Constants.MAX_POST_CHUNKS };
|
||||
var max = maxPosts;
|
||||
if (max == null) {
|
||||
max = 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 maxPosts
|
||||
var numPosts = Math.min(maxPosts, Constants.POST_CHUNK_SIZE);
|
||||
if (post_list && post_list.order.length > 0) {
|
||||
numPosts = Math.min(maxPosts, Constants.POST_CHUNK_SIZE * Math.ceil(post_list.order.length / Constants.POST_CHUNK_SIZE));
|
||||
var numPosts = Math.min(max, Constants.POST_CHUNK_SIZE);
|
||||
if (postList && postList.order.length > 0) {
|
||||
numPosts = Math.min(max, Constants.POST_CHUNK_SIZE * Math.ceil(postList.order.length / Constants.POST_CHUNK_SIZE));
|
||||
}
|
||||
|
||||
if (channelId != null) {
|
||||
callTracker['getPosts_'+channelId] = utils.getTimestamp();
|
||||
callTracker['getPosts_' + channelId] = utils.getTimestamp();
|
||||
|
||||
client.getPosts(
|
||||
channelId,
|
||||
0,
|
||||
@@ -377,15 +386,13 @@ module.exports.getPosts = function(force, id, maxPosts) {
|
||||
post_list: data
|
||||
});
|
||||
|
||||
PostStore.removeNonFailedPendingPosts(channelId);
|
||||
|
||||
module.exports.getProfiles();
|
||||
},
|
||||
function(err) {
|
||||
dispatchError(err, 'getPosts');
|
||||
},
|
||||
function() {
|
||||
callTracker['getPosts_'+channelId] = 0;
|
||||
callTracker['getPosts_' + channelId] = 0;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ module.exports = {
|
||||
RECIEVED_CHANNEL_EXTRA_INFO: null,
|
||||
|
||||
RECIEVED_POSTS: null,
|
||||
RECIEVED_POST: null,
|
||||
RECIEVED_SEARCH: null,
|
||||
RECIEVED_POST_SELECTED: null,
|
||||
RECIEVED_MENTION_DATA: null,
|
||||
@@ -62,6 +63,8 @@ module.exports = {
|
||||
GOOGLE_SERVICE: 'google',
|
||||
POST_CHUNK_SIZE: 60,
|
||||
MAX_POST_CHUNKS: 3,
|
||||
POST_LOADING: "loading",
|
||||
POST_FAILED: "failed",
|
||||
RESERVED_TEAM_NAMES: [
|
||||
"www",
|
||||
"web",
|
||||
|
||||
Ссылка в новой задаче
Block a user