Skip to content

Commit

Permalink
Merge pull request #94 from Discord-Dashboard/bugs
Browse files Browse the repository at this point in the history
Bugs
  • Loading branch information
iMidnights authored Oct 10, 2023
2 parents ea8a0ca + a51bfd6 commit 824c2c2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
12 changes: 10 additions & 2 deletions utils/functions/settingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 },
Expand Down
4 changes: 3 additions & 1 deletion views/settings.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@
</script>
<div class="container-fluid settings mb-4" id="<%= s.categoryId %>div">
<% 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
Expand Down

0 comments on commit 824c2c2

Please sign in to comment.