[FIX] Subscribe to settings making app to hang on login (#3254)
This commit is contained in:
parent
999f05bbd1
commit
6385daebb5
|
@ -131,6 +131,10 @@ export async function setSettings() {
|
||||||
reduxStore.dispatch(addSettings(RocketChat.parseSettings(parsed.slice(0, parsed.length))));
|
reduxStore.dispatch(addSettings(RocketChat.parseSettings(parsed.slice(0, parsed.length))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function subscribeSettings() {
|
||||||
|
return RocketChat.subscribe('stream-notify-all', 'public-settings-changed');
|
||||||
|
}
|
||||||
|
|
||||||
export default async function() {
|
export default async function() {
|
||||||
try {
|
try {
|
||||||
const db = database.active;
|
const db = database.active;
|
||||||
|
@ -146,7 +150,6 @@ export default async function() {
|
||||||
const filteredSettingsIds = filteredSettings.map(s => s._id);
|
const filteredSettingsIds = filteredSettings.map(s => s._id);
|
||||||
|
|
||||||
reduxStore.dispatch(addSettings(this.parseSettings(filteredSettings)));
|
reduxStore.dispatch(addSettings(this.parseSettings(filteredSettings)));
|
||||||
RocketChat.subscribe('stream-notify-all', 'public-settings-changed');
|
|
||||||
|
|
||||||
// filter server info
|
// filter server info
|
||||||
const serverInfo = filteredSettings.filter(i1 => serverInfoKeys.includes(i1._id));
|
const serverInfo = filteredSettings.filter(i1 => serverInfoKeys.includes(i1._id));
|
||||||
|
|
|
@ -28,7 +28,7 @@ import getUsersPresence, { getUserPresence, subscribeUsersPresence } from './met
|
||||||
|
|
||||||
import protectedFunction from './methods/helpers/protectedFunction';
|
import protectedFunction from './methods/helpers/protectedFunction';
|
||||||
import readMessages from './methods/readMessages';
|
import readMessages from './methods/readMessages';
|
||||||
import getSettings, { getLoginSettings, setSettings } from './methods/getSettings';
|
import getSettings, { getLoginSettings, setSettings, subscribeSettings } from './methods/getSettings';
|
||||||
|
|
||||||
import getRooms from './methods/getRooms';
|
import getRooms from './methods/getRooms';
|
||||||
import { setPermissions, getPermissions } from './methods/getPermissions';
|
import { setPermissions, getPermissions } from './methods/getPermissions';
|
||||||
|
@ -883,6 +883,7 @@ const RocketChat = {
|
||||||
getSettings,
|
getSettings,
|
||||||
getLoginSettings,
|
getLoginSettings,
|
||||||
setSettings,
|
setSettings,
|
||||||
|
subscribeSettings,
|
||||||
getPermissions,
|
getPermissions,
|
||||||
setPermissions,
|
setPermissions,
|
||||||
getCustomEmojis,
|
getCustomEmojis,
|
||||||
|
|
|
@ -80,6 +80,10 @@ const handleLoginRequest = function* handleLoginRequest({ credentials, logoutOnE
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const subscribeSettings = function* subscribeSettings() {
|
||||||
|
yield RocketChat.subscribeSettings();
|
||||||
|
};
|
||||||
|
|
||||||
const fetchPermissions = function* fetchPermissions() {
|
const fetchPermissions = function* fetchPermissions() {
|
||||||
yield RocketChat.getPermissions();
|
yield RocketChat.getPermissions();
|
||||||
};
|
};
|
||||||
|
@ -133,6 +137,7 @@ const handleLoginSuccess = function* handleLoginSuccess({ user }) {
|
||||||
yield fork(registerPushToken);
|
yield fork(registerPushToken);
|
||||||
yield fork(fetchUsersPresence);
|
yield fork(fetchUsersPresence);
|
||||||
yield fork(fetchEnterpriseModules, { user });
|
yield fork(fetchEnterpriseModules, { user });
|
||||||
|
yield fork(subscribeSettings);
|
||||||
yield put(encryptionInit());
|
yield put(encryptionInit());
|
||||||
|
|
||||||
setLanguage(user?.language);
|
setLanguage(user?.language);
|
||||||
|
|
Loading…
Reference in New Issue