summaryrefslogtreecommitdiffstats
path: root/web/react/components
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-07-27 11:30:03 -0400
committerJoramWilander <jwawilander@gmail.com>2015-08-11 12:09:54 -0400
commit1c0ee4d2f65d1d4434a3a16070abe7d61a268ce6 (patch)
treea10ebb3fb82ad16c015276b0618c1beda18755ff /web/react/components
parent4c7cdb20f074e2c06a08cd64a57060b8e8b64d2e (diff)
downloadchat-1c0ee4d2f65d1d4434a3a16070abe7d61a268ce6.tar.gz
chat-1c0ee4d2f65d1d4434a3a16070abe7d61a268ce6.tar.bz2
chat-1c0ee4d2f65d1d4434a3a16070abe7d61a268ce6.zip
added getChannel api service and use that over getChannels where appropriate on client
Diffstat (limited to 'web/react/components')
-rw-r--r--web/react/components/edit_channel_modal.jsx2
-rw-r--r--web/react/components/sidebar.jsx12
2 files changed, 7 insertions, 7 deletions
diff --git a/web/react/components/edit_channel_modal.jsx b/web/react/components/edit_channel_modal.jsx
index 06d7fc3e8..dcff5b89d 100644
--- a/web/react/components/edit_channel_modal.jsx
+++ b/web/react/components/edit_channel_modal.jsx
@@ -14,7 +14,7 @@ module.exports = React.createClass({
Client.updateChannelDesc(data,
function(data) {
this.setState({ server_error: "" });
- AsyncClient.getChannels(true);
+ AsyncClient.getChannel(this.state.channel_id);
$(this.refs.modal.getDOMNode()).modal('hide');
}.bind(this),
function(err) {
diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index fe73cbcf7..fa6302b6d 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -157,9 +157,9 @@ module.exports = React.createClass({
onSocketChange: function(msg) {
if (msg.action === 'posted') {
if (ChannelStore.getCurrentId() === msg.channel_id) {
- AsyncClient.getChannels(true, window.isActive);
+ if (window.isActive) AsyncClient.updateLastViewedAt();
} else {
- AsyncClient.getChannels(true);
+ AsyncClient.getChannel(msg.channel_id);
}
if (UserStore.getCurrentId() !== msg.user_id) {
@@ -213,13 +213,13 @@ module.exports = React.createClass({
utils.ding();
}
}
- } else if (msg.action === 'viewed') {
- if (ChannelStore.getCurrentId() != msg.channel_id) {
- AsyncClient.getChannels(true);
+ } else if (msg.action === "viewed") {
+ if (ChannelStore.getCurrentId() !== msg.channel_id && UserStore.getCurrentId() === msg.user_id) {
+ AsyncClient.getChannel(msg.channel_id);
}
} else if (msg.action === 'user_added') {
if (UserStore.getCurrentId() === msg.user_id) {
- AsyncClient.getChannels(true);
+ AsyncClient.getChannel(msg.channel_id);
}
} else if (msg.action === 'user_removed') {
if (msg.user_id === UserStore.getCurrentId()) {