Removed subscribeSettings

This commit is contained in:
Gerzon Z 2021-04-23 07:08:24 -04:00
parent 3e5e967223
commit 43f06cfc92
4 changed files with 2 additions and 30 deletions

View File

@ -7,7 +7,7 @@ export function addSettings(settings) {
};
}
export function updateSettings(id, value) {
export function updateSetting(id, value) {
return {
type: SETTINGS.UPDATE,
payload: { id, value }

View File

@ -41,11 +41,6 @@ const loginSettings = [
'Accounts_Iframe_api_method'
];
export function subscribeSettings() {
this.sdk.subscribe('stream-notify-all', 'public-settings-changed');
this.sdk.subscribe('stream-notify-logged', 'private-settings-changed');
}
const serverInfoUpdate = async(serverInfo, iconSetting) => {
const serversDB = database.servers;
const serverId = reduxStore.getState().server.server;
@ -197,7 +192,6 @@ export default async function() {
}
return allRecords.length;
});
subscribeSettings();
} catch (e) {
log(e);
}

View File

@ -27,7 +27,7 @@ import getUsersPresence, { getUserPresence, subscribeUsersPresence } from './met
import protectedFunction from './methods/helpers/protectedFunction';
import readMessages from './methods/readMessages';
import getSettings, { getLoginSettings, setSettings, subscribeSettings } from './methods/getSettings';
import getSettings, { getLoginSettings, setSettings } from './methods/getSettings';
import getRooms from './methods/getRooms';
import { setPermissions, getPermissions } from './methods/getPermissions';
@ -60,7 +60,6 @@ import UserPreferences from './userPreferences';
import { Encryption } from './encryption';
import EventEmitter from '../utils/events';
import { sanitizeLikeString } from './database/utils';
import { updateSettings } from '../actions/settings';
const TOKEN_KEY = 'reactnativemeteor_usertoken';
const CURRENT_SERVER = 'currentServer';
@ -294,21 +293,6 @@ const RocketChat = {
} catch {
// We can't create a new record since we don't receive the user._id
}
} else if (/private-settings-changed/.test(eventName)) {
const { _id, value } = ddpMessage.fields.args[1];
const db = database.active;
const settingsCollection = db.get('settings');
try {
const settingsRecord = await settingsCollection.find(_id);
await db.action(async() => {
await settingsRecord.update((u) => {
u._raw.value_as_boolean = value;
});
});
reduxStore.dispatch(updateSettings(_id, value));
} catch (err) {
console.log(err);
}
} else if (/Users:NameChanged/.test(eventName)) {
const userNameChanged = ddpMessage.fields.args[0];
const db = database.active;
@ -1455,7 +1439,6 @@ const RocketChat = {
getUsersPresence,
getUserPresence,
subscribeUsersPresence,
subscribeSettings,
getDirectory({
query, count, offset, sort
}) {

View File

@ -106,10 +106,6 @@ const fetchUsersPresence = function* fetchUserPresence() {
RocketChat.subscribeUsersPresence();
};
const subscribeSettings = function* subscribeSetting() {
yield RocketChat.subscribeSettings();
};
const fetchEnterpriseModules = function* fetchEnterpriseModules({ user }) {
yield RocketChat.getEnterpriseModules();
@ -136,7 +132,6 @@ const handleLoginSuccess = function* handleLoginSuccess({ user }) {
yield fork(fetchSlashCommands);
yield fork(registerPushToken);
yield fork(fetchUsersPresence);
yield fork(subscribeSettings);
yield fork(fetchEnterpriseModules, { user });
yield put(encryptionInit());