From c0ab2636d699c8544ce03a58f61b95cfd66ff7ce Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 18 Jul 2016 11:10:03 -0400 Subject: PLT-2241 Refactored statuses into a more real-time system (#3573) * Refactored statuses into a more real-time system * Updated package.json with correct commit and fixed minor bug * Minor updates to statuses based on feedback * When setting status online, update only LastActivityAt if status already exists --- webapp/utils/async_client.jsx | 16 +++------------- webapp/utils/constants.jsx | 9 ++++++++- 2 files changed, 11 insertions(+), 14 deletions(-) (limited to 'webapp/utils') diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index b31a2a6b9..0241db90d 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -7,7 +7,6 @@ import * as GlobalActions from 'actions/global_actions.jsx'; import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; import BrowserStore from 'stores/browser_store.jsx'; import ChannelStore from 'stores/channel_store.jsx'; -import PreferenceStore from 'stores/preference_store.jsx'; import PostStore from 'stores/post_store.jsx'; import UserStore from 'stores/user_store.jsx'; import * as utils from './utils.jsx'; @@ -744,21 +743,12 @@ export function getMe() { } export function getStatuses() { - const preferences = PreferenceStore.getCategory(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW); - - const teammateIds = []; - for (const [name, value] of preferences) { - if (value === 'true') { - teammateIds.push(name); - } - } - - if (isCallInProgress('getStatuses') || teammateIds.length === 0) { + if (isCallInProgress('getStatuses')) { return; } callTracker.getStatuses = utils.getTimestamp(); - Client.getStatuses(teammateIds, + Client.getStatuses( (data) => { callTracker.getStatuses = 0; @@ -1535,4 +1525,4 @@ export function deleteEmoji(id) { dispatchError(err, 'deleteEmoji'); } ); -} \ No newline at end of file +} diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx index d780efe30..fda0508af 100644 --- a/webapp/utils/constants.jsx +++ b/webapp/utils/constants.jsx @@ -191,7 +191,8 @@ export const Constants = { USER_REMOVED: 'user_removed', TYPING: 'typing', PREFERENCE_CHANGED: 'preference_changed', - EPHEMERAL_MESSAGE: 'ephemeral_message' + EPHEMERAL_MESSAGE: 'ephemeral_message', + STATUS_CHANGED: 'status_change' }, UserUpdateEvents: { @@ -210,6 +211,12 @@ export const Constants = { POST: 5 }, + UserStatuses: { + OFFLINE: 'offline', + AWAY: 'away', + ONLINE: 'online' + }, + SPECIAL_MENTIONS: ['all', 'channel'], CHARACTER_LIMIT: 4000, IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png', 'jpeg'], -- cgit v1.2.3-1-g7c22