1- import type { IExtras , IRoomActivity , IActionsObject , IUser } from '@rocket.chat/core-typings' ;
1+ import type { IExtras , IRoomActivity , IUser } from '@rocket.chat/core-typings' ;
2+ import { Emitter } from '@rocket.chat/emitter' ;
23import { debounce } from 'lodash' ;
34import { Meteor } from 'meteor/meteor' ;
4- import { ReactiveDict } from 'meteor/reactive-dict' ;
55
66import { Users } from '../../../../client/stores' ;
77import { settings } from '../../../settings/client' ;
@@ -25,7 +25,8 @@ const continuingIntervals = new Map();
2525const roomActivities = new Map < string , Set < string > > ( ) ;
2626const rooms = new Map < string , ( username : string , activityType : string [ ] , extras ?: object | undefined ) => void > ( ) ;
2727
28- const performingUsers = new ReactiveDict < IActionsObject > ( ) ;
28+ const performingUsers = new Map < string , IRoomActivity > ( ) ;
29+ const performingUsersEmitter = new Emitter < { changed : void } > ( ) ;
2930
3031const shownName = function ( user : IUser | null | undefined ) : string | undefined {
3132 if ( ! user ) {
@@ -64,6 +65,7 @@ function handleStreamAction(rid: string, username: string, activityTypes: string
6465 }
6566
6667 performingUsers . set ( rid , roomActivities ) ;
68+ performingUsersEmitter . emit ( 'changed' ) ;
6769}
6870export const UserAction = new ( class {
6971 addStream ( rid : string ) : ( ) => void {
@@ -169,4 +171,8 @@ export const UserAction = new (class {
169171 get ( roomId : string ) : IRoomActivity | undefined {
170172 return performingUsers . get ( roomId ) ;
171173 }
174+
175+ subscribe ( onChanged : ( ) => void ) : ( ) => void {
176+ return performingUsersEmitter . on ( 'changed' , onChanged ) ;
177+ }
172178} ) ( ) ;
0 commit comments