File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
ui-message/client/messageBox Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,13 @@ import { Template } from 'meteor/templating';
22
33import { MsgTyping } from '../../../ui' ;
44import { t } from '../../../utils' ;
5+ import { getConfig } from '../../../ui-utils/client/config' ;
56import './messageBoxTyping.html' ;
67
8+ const maxUsernames = parseInt ( getConfig ( 'max-usernames-typing' ) ) || 4 ;
79
810Template . messageBoxTyping . helpers ( {
911 data ( ) {
10- const maxUsernames = 4 ;
1112 const users = MsgTyping . get ( this . rid ) ;
1213 if ( users . length === 0 ) {
1314 return ;
Original file line number Diff line number Diff 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 ] ;
You can’t perform that action at this time.
0 commit comments