diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-08-11 08:20:17 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-08-11 12:11:35 -0400 |
commit | 4ec76e059cddc127c35bf758f7fda7c7636c8d70 (patch) | |
tree | 4ecc9322edf6eba7cf8f47d655339861b3e54ae9 /web | |
parent | 6c0fefad152e1843bccf80fb675301b789f70dd5 (diff) | |
download | chat-4ec76e059cddc127c35bf758f7fda7c7636c8d70.tar.gz chat-4ec76e059cddc127c35bf758f7fda7c7636c8d70.tar.bz2 chat-4ec76e059cddc127c35bf758f7fda7c7636c8d70.zip |
incorporate channel updateAt into channel counts and pull channel data on channel update
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/more_channels.jsx | 2 | ||||
-rw-r--r-- | web/react/components/sidebar.jsx | 1 | ||||
-rw-r--r-- | web/react/utils/async_client.jsx | 6 |
3 files changed, 5 insertions, 4 deletions
diff --git a/web/react/components/more_channels.jsx b/web/react/components/more_channels.jsx index e851283ae..5261ed6a7 100644 --- a/web/react/components/more_channels.jsx +++ b/web/react/components/more_channels.jsx @@ -74,7 +74,7 @@ module.exports = React.createClass({ moreChannels = ( <table className='more-channel-table table'> <tbody> - {moreChannels.map(function cMap(channel) { + {channels.map(function cMap(channel) { return ( <tr key={channel.id}> <td> diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx index 6ad606e5e..f6ac36f50 100644 --- a/web/react/components/sidebar.jsx +++ b/web/react/components/sidebar.jsx @@ -161,7 +161,6 @@ module.exports = React.createClass({ AsyncClient.updateLastViewedAt(); } } else { - console.log('hit'); AsyncClient.getChannels(); } diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index 545c85fc2..7e8a6116c 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -99,11 +99,13 @@ function getChannels(force, updateLastViewed, checkVersion) { } var countMap = data.counts; + var updateAtMap = data.update_times; for (var id in countMap) { - var chan = ChannelStore.get(id); + var c = ChannelStore.get(id); var count = countMap[id]; - if (!chan || chan.total_msg_count !== count) { + var updateAt = updateAtMap[id]; + if (!c || c.total_msg_count !== count || updateAt > c.update_at) { getChannel(id); } } |