migratePluginToSettings: Update
This commit is contained in:
parent
038aa10bbf
commit
048be833bd
1 changed files with 7 additions and 11 deletions
|
|
@ -254,19 +254,15 @@ export function useSettings(paths?: UseSettings<Settings>[]) {
|
|||
export function migratePluginToSettings(newName: string, oldName: string, ...settingNames: string[]) {
|
||||
const { plugins } = SettingsStore.plain;
|
||||
const newPlugin = plugins[newName];
|
||||
const oldPlugin = plugins[oldName];
|
||||
|
||||
if (!newPlugin || !oldPlugin) return;
|
||||
if (!newPlugin) return;
|
||||
|
||||
if (oldPlugin?.enabled) {
|
||||
for (const settingName of settingNames) {
|
||||
logger.info(`Migrating plugin to setting from old name ${oldName} to ${newName} as ${settingName}`);
|
||||
oldPlugin.enabled = false;
|
||||
newPlugin[settingName] = true;
|
||||
if (!newPlugin?.enabled) newPlugin.enabled = true;
|
||||
delete plugins[oldName];
|
||||
SettingsStore.markAsChanged();
|
||||
}
|
||||
for (const settingName of settingNames) {
|
||||
logger.info(`Migrating plugin to setting from old name ${oldName} to ${newName} as ${settingName}`);
|
||||
newPlugin[settingName] = true;
|
||||
newPlugin.enabled = true;
|
||||
delete plugins[oldName];
|
||||
SettingsStore.markAsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue