summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-10-27 12:24:30 -0300
committerHarrison Healey <harrisonmhealey@gmail.com>2016-10-27 11:24:30 -0400
commitf82667f3b86202dafff3a2a4ea56aec74c80316d (patch)
tree3785d9502505be528706e41b993a834c7bc00338 /webapp/utils
parent14ce471311fee2830be3cbd3a90179015f513719 (diff)
downloadchat-f82667f3b86202dafff3a2a4ea56aec74c80316d.tar.gz
chat-f82667f3b86202dafff3a2a4ea56aec74c80316d.tar.bz2
chat-f82667f3b86202dafff3a2a4ea56aec74c80316d.zip
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
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/async_client.jsx33
-rw-r--r--webapp/utils/constants.jsx1
2 files changed, 30 insertions, 4 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index ee9d1a4f0..67100ea3f 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -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) => {
diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx
index f87b36fc8..6ea8d040e 100644
--- a/webapp/utils/constants.jsx
+++ b/webapp/utils/constants.jsx
@@ -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,