chore: Remove meteor cached collection startup for anons (#33975)
parent
2db1ecb0ef
commit
8f8e413b35
@ -0,0 +1,16 @@ |
||||
import { useSetting, useUserId } from '@rocket.chat/ui-contexts'; |
||||
import { useEffect } from 'react'; |
||||
|
||||
import { CachedChatRoom, CachedChatSubscription } from '../../app/models/client'; |
||||
|
||||
export const useLoadRoomForAllowedAnonymousRead = () => { |
||||
const userId = useUserId(); |
||||
const accountsAllowAnonymousRead = useSetting('Accounts_AllowAnonymousRead'); |
||||
|
||||
useEffect(() => { |
||||
if (!userId && accountsAllowAnonymousRead === true) { |
||||
CachedChatRoom.init(); |
||||
CachedChatSubscription.ready.set(true); |
||||
} |
||||
}, [accountsAllowAnonymousRead, userId]); |
||||
}; |
||||
@ -1,14 +0,0 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import { Tracker } from 'meteor/tracker'; |
||||
|
||||
import { CachedChatRoom, CachedChatSubscription } from '../../app/models/client'; |
||||
import { settings } from '../../app/settings/client'; |
||||
|
||||
Meteor.startup(() => { |
||||
Tracker.autorun(() => { |
||||
if (!Meteor.userId() && settings.get('Accounts_AllowAnonymousRead') === true) { |
||||
CachedChatRoom.init(); |
||||
CachedChatSubscription.ready.set(true); |
||||
} |
||||
}); |
||||
}); |
||||
Loading…
Reference in new issue