Fix settings resetting not initializing dictionary settings properly (#1036)

This commit is contained in:
toasted-nutbread 2020-11-15 14:14:52 -05:00 committed by GitHub
parent 2e3169f68c
commit d66a5e3b87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 5 deletions

View File

@ -16,6 +16,7 @@
*/
/* global
* DictionaryController
* Modal
* OptionsUtil
* api
@ -383,6 +384,14 @@ class BackupController {
// Get default options
const optionsFull = this._optionsUtil.getDefault();
// Update dictionaries
const dictionaries = await this._settingsController.getDictionaryInfo();
for (const {options: {dictionaries: optionsDictionaries}} of optionsFull.profiles) {
for (const {title} of dictionaries) {
optionsDictionaries[title] = DictionaryController.createDefaultDictionarySettings();
}
}
// Assign options
try {
await this._settingsImportSetOptionsFull(optionsFull);

View File

@ -489,11 +489,7 @@ class DictionaryController {
targets.push({
action: 'set',
path,
value: {
enabled: false,
allowSecondarySearches: false,
priority: 0
}
value: DictionaryController.createDefaultDictionarySettings()
});
}
}
@ -502,4 +498,12 @@ class DictionaryController {
await this._settingsController.modifyGlobalSettings(targets);
}
}
static createDefaultDictionarySettings() {
return {
enabled: false,
allowSecondarySearches: false,
priority: 0
};
}
}