PLT-4430 improve slow channel switching (#4331)

* PLT-4430 improve slow channel switching

* Update client side unit tests

* Convert getChannelsUnread to getMyChannelMembers and address other feedback

* Pull channel members on websocket reconnect
Этот коммит содержится в:
enahum
2016-10-27 12:24:30 -03:00
коммит произвёл Harrison Healey
родитель 14ce471311
Коммит f82667f3b8
22 изменённых файлов: 271 добавлений и 117 удалений

Просмотреть файл

@@ -80,8 +80,7 @@ export function getChannels(doVersionCheck) {
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_CHANNELS,
channels: data.channels,
members: data.members
channels: data
});
},
(err) => {
@@ -115,6 +114,33 @@ export function getChannel(id) {
);
}
export function getMyChannelMembers(doVersionCheck) {
if (isCallInProgress('getMyChannelMembers')) {
return;
}
callTracker.getMyChannelMembers = utils.getTimestamp();
Client.getMyChannelMembers(
(data) => {
callTracker.getMyChannelMembers = 0;
if (doVersionCheck) {
checkVersion();
}
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_MY_CHANNEL_MEMBERS,
members: data
});
},
(err) => {
callTracker.getChannelsUnread = 0;
dispatchError(err, 'getMyChannelMembers');
}
);
}
export function updateLastViewedAt(id, active) {
let channelId;
if (id) {
@@ -205,8 +231,7 @@ export function getMoreChannels(force) {
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_MORE_CHANNELS,
channels: data.channels,
members: data.members
channels: data
});
},
(err) => {

Просмотреть файл

@@ -73,6 +73,7 @@ export const ActionTypes = keyMirror({
RECEIVED_CHANNEL: null,
RECEIVED_MORE_CHANNELS: null,
RECEIVED_CHANNEL_STATS: null,
RECEIVED_MY_CHANNEL_MEMBERS: null,
FOCUS_POST: null,
RECEIVED_POSTS: null,