Keep SQUID settings usable with unknown metadata and preserve translations

This commit is contained in:
Дмитрий committed 2026-10-05 18:09:36 +05:00
1 parent f8301d7394
commit 654b7cddd3
6 files changed
+60 -16

No files matched your search

+1 -1
View File
@@ -42,6 +42,6 @@ export function squidSettingsView(items: ModuleSetting[], locale: Locale): Setti
};
});
const categories = new Map(groups.map(g => [g.id, g.titles[languages.indexOf(locale)]]));
for (const item of items) if (item.field?.group) categories.set("squid." + item.field.group, item.field.group_title ?? categories.get("squid." + item.field.group) ?? item.field.group);
for (const item of items) if (item.field?.group) categories.set("squid." + item.field.group, categories.get("squid." + item.field.group) ?? item.field.group_title ?? item.field.group);
return { scope: "bots", categories: [...categories].map(([id, title]) => ({ id, title })), settings, unknown_keys: 0, drift_keys: [], files: ["Core/configs/modules/playerbots.conf"] };
}