fix: Error when non-support setting change is received via stream (#5487)

This commit is contained in:
Gopal Verma 2024-01-23 04:10:03 +05:30 committed by GitHub
parent 0639d22e30
commit f7e443a670
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 23 additions and 17 deletions

View File

@ -138,6 +138,9 @@ function connect({ server, logoutOnError = false }: { server: string; logoutOnEr
const { _id, value } = ddpMessage.fields.args[1];
const db = database.active;
const settingsCollection = db.get('settings');
// Check if the _id exists in defaultSettings
if (defaultSettings.hasOwnProperty(_id)) {
try {
const settingsRecord = await settingsCollection.find(_id);
// @ts-ignore
@ -158,6 +161,9 @@ function connect({ server, logoutOnError = false }: { server: string; logoutOnEr
} catch (e) {
log(e);
}
} else {
console.warn(`Setting with _id '${_id}' is not present in defaultSettings.`);
}
}
})
);