The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/cachedStores/PrivateSettingsCachedStore.ts

31 lines
888 B

import type { ISetting } from '@rocket.chat/core-typings';
import { sdk } from '../../app/utils/client/lib/SDKClient';
import { PrivateCachedStore } from '../lib/cachedStores/CachedStore';
import { PrivateSettings } from '../stores';
class PrivateSettingsCachedStore extends PrivateCachedStore<ISetting> {
constructor() {
super({
name: 'private-settings',
eventType: 'notify-logged',
store: PrivateSettings.use,
});
}
override setupListener() {
return sdk.stream('notify-logged', ['private-settings-changed'], async (t, setting) => {
this.log('record received', t, setting);
const { _id, ...fields } = setting;
this.store.getState().update(
(record) => record._id === _id,
(record) => ({ ...record, ...fields }),
);
this.sync();
});
}
}
const instance = new PrivateSettingsCachedStore();
export { instance as PrivateSettingsCachedStore };