From 450c0b3ccb091a3f84f35aca0319ba358ffd5633 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 30 Jan 2017 15:43:34 -0500 Subject: Improvments to typing messages (#5230) --- webapp/actions/global_actions.jsx | 4 +++- webapp/stores/user_typing_store.jsx | 2 +- webapp/utils/constants.jsx | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'webapp') diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index c8da43f24..beca75509 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -454,7 +454,9 @@ export function viewLoggedIn() { let lastTimeTypingSent = 0; export function emitLocalUserTypingEvent(channelId, parentId) { const t = Date.now(); - if ((t - lastTimeTypingSent) > Constants.UPDATE_TYPING_MS) { + const membersInChannel = ChannelStore.getStats(channelId).member_count; + + if (((t - lastTimeTypingSent) > global.window.mm_config.TimeBetweenUserTypingUpdatesMilliseconds) && membersInChannel < global.window.mm_config.MaxNotificationsPerChannel && global.window.mm_config.EnableUserTypingMessages === 'true') { WebSocketClient.userTyping(channelId, parentId); lastTimeTypingSent = t; } diff --git a/webapp/stores/user_typing_store.jsx b/webapp/stores/user_typing_store.jsx index 85c10bfbe..8bbce117f 100644 --- a/webapp/stores/user_typing_store.jsx +++ b/webapp/stores/user_typing_store.jsx @@ -64,7 +64,7 @@ class UserTypingStoreClass extends EventEmitter { Reflect.deleteProperty(this.typingUsers, loc); } this.emitChange(); - }, Constants.UPDATE_TYPING_MS); + }, parseInt(window.mm_config.TimeBetweenUserTypingUpdatesMilliseconds, 10)); this.emitChange(); } diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx index dd9a4486e..bd50534f2 100644 --- a/webapp/utils/constants.jsx +++ b/webapp/utils/constants.jsx @@ -407,7 +407,6 @@ export const Constants = { REPLY_ICON: " ", SCROLL_BOTTOM_ICON: " ", VIDEO_ICON: " ", - UPDATE_TYPING_MS: 5000, THEMES: { default: { type: 'Organization', -- cgit v1.2.3-1-g7c22