summaryrefslogtreecommitdiffstats
path: root/web/react/utils/async_client.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-12-09 19:16:50 -0500
committerChristopher Speller <crspeller@gmail.com>2015-12-09 19:16:50 -0500
commit468d8ed053b1126d9821b099d4acaeaf8e11f334 (patch)
treeda57414d03887a1cdff3f8c51caa0bd74db7f0c1 /web/react/utils/async_client.jsx
parent985dc06e5fb9d809e4be4e5fff2c3b1ca66c1ea9 (diff)
parent99d79eee56a1b5a27f18fffd90545b4aef191bba (diff)
downloadchat-468d8ed053b1126d9821b099d4acaeaf8e11f334.tar.gz
chat-468d8ed053b1126d9821b099d4acaeaf8e11f334.tar.bz2
chat-468d8ed053b1126d9821b099d4acaeaf8e11f334.zip
Merge pull request #1625 from florianorben/ephemeral_messages
add helper method to add ephemeral messages; also switch 'delete mess…
Diffstat (limited to 'web/react/utils/async_client.jsx')
-rw-r--r--web/react/utils/async_client.jsx15
1 files changed, 14 insertions, 1 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index 88b5aa739..9cdbd73a4 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -82,7 +82,7 @@ export function getChannels(checkVersion) {
);
}
-export function getChannel(id) {
+export function getChannelAndAddUnreadMessages(id, unreadCount) {
if (isCallInProgress('getChannel' + id)) {
return;
}
@@ -97,6 +97,7 @@ export function getChannel(id) {
return;
}
+ data.channel.total_msg_count += (unreadCount || 0);
AppDispatcher.handleServerAction({
type: ActionTypes.RECIEVED_CHANNEL,
channel: data.channel,
@@ -110,6 +111,10 @@ export function getChannel(id) {
);
}
+export function getChannel(id) {
+ getChannelAndAddUnreadMessages(id, 0);
+}
+
export function updateLastViewedAt(id) {
let channelId;
if (id) {
@@ -131,6 +136,14 @@ export function updateLastViewedAt(id) {
channelId,
() => {
callTracker.updateLastViewed = 0;
+
+ var channel = ChannelStore.get(channelId);
+ var member = ChannelStore.getMember(channelId);
+ if (channel && member) {
+ member.msg_count = channel.total_msg_count;
+ member.last_viewed_at = utils.getTimestamp();
+ ChannelStore.setChannelMember(member);
+ }
},
(err) => {
callTracker.updateLastViewed = 0;