Remove unused settings from Rocket.Chat
- 2019-11-14
- Web Rocket.Chat
I was going to add a new setting item - Apps_Game_Center_enabled
into the settings page, but some extra unwanted settings were also added to this group. Although, I've already removed these items from the MongoDB. I still saw them in the settings page, it's so weird...
By diving into the codebase, I finally found that we are using PrivateSettingsCachedCollection
to cache the settings. With this finding, I solved the issue with the following code:
Inject the following code below 1
2
3
4...
const rcSettings = settings.collectionPrivate.find({ group: groupId }, { sort: { section: 1, sorter: 1, i18nLabel: 1 } }).fetch();
const sections = {};
...
1 | // the code to be injected |
Lastly, run meteor shell
and .reload
to reload the project, you will find the extra settings have be removed from the collection 😆