diff --git a/package.json b/package.json index c0db7460..bcd3e51e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dbd-soft-ui", - "version": "1.7.15-beta.1", + "version": "1.7.16-beta.1", "typings": "dbd-soft-ui.d.ts", "author": { "name": "iMidnight" diff --git a/utils/functions/settingsPage.js b/utils/functions/settingsPage.js index ebcf7d9a..5dac21d2 100644 --- a/utils/functions/settingsPage.js +++ b/utils/functions/settingsPage.js @@ -55,6 +55,14 @@ module.exports = function (config, themeConfig) { let canUseList = {} + const options = config.settings.map(s => { + const category = s.categoryOptionsList + return category.map(c => { + const option = c.optionType + return option.type === "multiRow" ? option.options : option + }) + }).flat(Infinity) + if (config.settings?.length) for (const category of config.settings) { if (!canUseList[category.categoryId]) canUseList[category.categoryId] = {}; if (!actual[category.categoryId]) actual[category.categoryId] = {} @@ -107,7 +115,7 @@ module.exports = function (config, themeConfig) { ) continue; } - const option = category.categoryOptionsList.find( + const option = options.find( (c) => c.optionId == o.optionId ) if (option) { @@ -192,7 +200,7 @@ module.exports = function (config, themeConfig) { } } - for (const c of s.categoryOptionsList) { + for (const c of options) { if (c.allowedCheck) { const canUse = await c.allowedCheck({ guild: { id: req.params.id }, diff --git a/views/settings.ejs b/views/settings.ejs index cd15507a..54d79b96 100644 --- a/views/settings.ejs +++ b/views/settings.ejs @@ -340,7 +340,9 @@
<% s.categoryOptionsList.forEach( option=> { - let Allowed = canUseList[s.categoryId][option.optionId]; + console.log(option) + let Allowed = canUseList?.[s.categoryId]?.[option.optionId]; + if (!Allowed) Allowed = { allowed: true, reason: "No reason provided" } ; %> <% if (!option.themeOptions) option.themeOptions={}; let