Skip to content

Commit 6153a2f

Browse files
authored
[FIX] users typing forever (RocketChat#14724)
1 parent 132ed10 commit 6153a2f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

app/ui-message/client/messageBox/messageBoxTyping.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import { Template } from 'meteor/templating';
22

33
import { MsgTyping } from '../../../ui';
44
import { t } from '../../../utils';
5+
import { getConfig } from '../../../ui-utils/client/config';
56
import './messageBoxTyping.html';
67

8+
const maxUsernames = parseInt(getConfig('max-usernames-typing')) || 4;
79

810
Template.messageBoxTyping.helpers({
911
data() {
10-
const maxUsernames = 4;
1112
const users = MsgTyping.get(this.rid);
1213
if (users.length === 0) {
1314
return;

app/ui/client/lib/msgTyping.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ export const MsgTyping = new class {
3838

3939
cancel(rid) {
4040
if (rooms[rid]) {
41-
delete rooms[rid];
4241
Notifications.unRoom(rid, 'typing', rooms[rid]);
42+
Object.values(usersTyping.get(rid) || {}).forEach(clearTimeout);
43+
usersTyping.set(rid);
44+
delete rooms[rid];
4345
}
4446
}
4547

@@ -56,8 +58,9 @@ export const MsgTyping = new class {
5658
if (typing === true) {
5759
clearTimeout(users[username]);
5860
users[username] = setTimeout(function() {
59-
delete users[username];
60-
usersTyping.set(rid, users);
61+
const u = usersTyping.get(rid);
62+
delete u[username];
63+
usersTyping.set(rid, u);
6164
}, timeout);
6265
} else {
6366
delete users[username];

0 commit comments

Comments
 (0)