From b180baabcf9010f694abf16236db858d38faa81b Mon Sep 17 00:00:00 2001 From: iMidnight Date: Tue, 10 Oct 2023 22:35:24 +0100 Subject: [PATCH 1/3] Update settingsPage.js --- utils/functions/settingsPage.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 }, From 17b75c8d616c33c429274e6f03c96a1c12c5a536 Mon Sep 17 00:00:00 2001 From: iMidnight Date: Tue, 10 Oct 2023 22:35:39 +0100 Subject: [PATCH 2/3] Update settings.ejs --- views/settings.ejs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 From a51bfd647e91d21561225a2c73e1a8250b289167 Mon Sep 17 00:00:00 2001 From: iMidnight Date: Tue, 10 Oct 2023 22:35:56 +0100 Subject: [PATCH 3/3] Bump ver --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"