summaryrefslogtreecommitdiffstats
path: root/webapp/utils/async_client.jsx
diff options
context:
space:
mode:
authorsamogot <samogot@gmail.com>2016-07-14 15:19:27 +0300
committerJoram Wilander <jwawilander@gmail.com>2016-07-14 08:19:27 -0400
commit9b9facd3d21a7ab341dd6d80fd8b53fb852ae036 (patch)
tree11418f04ce57bb6083797c29ceba690b97302e15 /webapp/utils/async_client.jsx
parent6abc9601bec18e5005ff16dd4147bf038dafb264 (diff)
downloadchat-9b9facd3d21a7ab341dd6d80fd8b53fb852ae036.tar.gz
chat-9b9facd3d21a7ab341dd6d80fd8b53fb852ae036.tar.bz2
chat-9b9facd3d21a7ab341dd6d80fd8b53fb852ae036.zip
PLT-3366 Holding down the ALT key and clicking on a message adds a new messages indicator (squashed) (#3374)
Diffstat (limited to 'webapp/utils/async_client.jsx')
-rw-r--r--webapp/utils/async_client.jsx37
1 files changed, 37 insertions, 0 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index e55742140..2e26278b2 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -145,6 +145,43 @@ export function updateLastViewedAt(id) {
);
}
+export function setLastViewedAt(lastViewedAt, id) {
+ let channelId;
+ if (id) {
+ channelId = id;
+ } else {
+ channelId = ChannelStore.getCurrentId();
+ }
+
+ if (channelId == null) {
+ return;
+ }
+
+ if (lastViewedAt == null) {
+ return;
+ }
+
+ if (isCallInProgress(`setLastViewedAt${channelId}${lastViewedAt}`)) {
+ return;
+ }
+
+ callTracker[`setLastViewedAt${channelId}${lastViewedAt}`] = utils.getTimestamp();
+ Client.setLastViewedAt(
+ channelId,
+ lastViewedAt,
+ () => {
+ callTracker.setLastViewedAt = 0;
+ ErrorStore.clearLastError();
+ },
+ (err) => {
+ callTracker.setLastViewedAt = 0;
+ var count = ErrorStore.getConnectionErrorCount();
+ ErrorStore.setConnectionErrorCount(count + 1);
+ dispatchError(err, 'setLastViewedAt');
+ }
+ );
+}
+
export function getMoreChannels(force) {
if (isCallInProgress('getMoreChannels')) {
return;