Skip to content

Commit

Permalink
dev demo: touch typing-status constants
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbobbe committed Oct 18, 2023
1 parent 86d94fa commit b831448
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions patches/@zulip+shared+0.0.18.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/node_modules/@zulip/shared/lib/typing_status.js b/node_modules/@zulip/shared/lib/typing_status.js
index f7c3e9c..0135530 100644
--- a/node_modules/@zulip/shared/lib/typing_status.js
+++ b/node_modules/@zulip/shared/lib/typing_status.js
@@ -5,10 +5,10 @@ import _ from "lodash";
// depending on your perspective.) See typing_events.js.
// How frequently 'still typing' notifications are sent
// to extend the expiry
-const TYPING_STARTED_WAIT_PERIOD = 10000; // 10s
+const TYPING_STARTED_WAIT_PERIOD = 10001; // 10s
// How long after someone stops editing in the compose box
// do we send a 'stopped typing' notification
-const TYPING_STOPPED_WAIT_PERIOD = 5000; // 5s
+const TYPING_STOPPED_WAIT_PERIOD = 5001; // 5s
/** Exported only for tests. */
export const state = {};
/** Exported only for tests. */
4 changes: 2 additions & 2 deletions src/typing/typingActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ export const clearTyping = (outdatedNotifications: $ReadOnlyArray<string>): PerA
const typingStatusExpiryLoop = () => async (dispatch, getState) => {
// loop to auto dismiss typing notifications after typingNotificationTimeout
while (true) {
await sleep(15000);
await sleep(15001);
const currentTime = new Date().getTime();
const typing = getTyping(getState());
if (Object.keys(typing).length === 0) {
break; // break if no typing notifications
}
const outdatedNotifications = [];
Object.keys(typing).forEach(recipients => {
if (currentTime - typing[recipients].time >= 15000) {
if (currentTime - typing[recipients].time >= 15001) {
outdatedNotifications.push(recipients);
}
});
Expand Down

0 comments on commit b831448

Please sign in to comment.