From 90c0bc410ed2bb8afb151ac4c7b7dab363fe3118 Mon Sep 17 00:00:00 2001 From: KyrneDev Date: Wed, 24 Mar 2021 17:29:54 -1000 Subject: [PATCH 1/2] Null name/desc breaks search fix --- js/src/admin/components/AdminNav.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/src/admin/components/AdminNav.js b/js/src/admin/components/AdminNav.js index 8ee4b9699..0c307e7b3 100644 --- a/js/src/admin/components/AdminNav.js +++ b/js/src/admin/components/AdminNav.js @@ -126,16 +126,17 @@ export default class AdminNav extends Component { categorizedExtensions[category].map((extension) => { const query = this.query().toUpperCase(); - const title = extension.extra['flarum-extension'].title; + const title = extension.extra['flarum-extension'].title || ''; + const description = extension.description || ''; - if (!query || title.toUpperCase().includes(query) || extension.description.toUpperCase().includes(query)) { + if (!query || title.toUpperCase().includes(query) || description.toUpperCase().includes(query)) { items.add( `extension-${extension.id}`, {title} , From 0eefbf037413d771fd86085e89f8fc5fc9473246 Mon Sep 17 00:00:00 2001 From: KyrneDev Date: Wed, 24 Mar 2021 17:30:13 -1000 Subject: [PATCH 2/2] Help on redraw --- js/src/admin/components/AdminPage.js | 30 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/js/src/admin/components/AdminPage.js b/js/src/admin/components/AdminPage.js index 4c009c7da..6dc1a5a4a 100644 --- a/js/src/admin/components/AdminPage.js +++ b/js/src/admin/components/AdminPage.js @@ -98,35 +98,41 @@ export default class AdminPage extends Page { return entry.call(this); } - const setting = entry.setting; - const help = entry.help; - delete entry.help; + const { setting, help, ...componentAttrs } = entry; + + delete componentAttrs.help; const value = this.setting([setting])(); - if (['bool', 'checkbox', 'switch', 'boolean'].includes(entry.type)) { + if (['bool', 'checkbox', 'switch', 'boolean'].includes(componentAttrs.type)) { return (
- - {entry.label} + + {componentAttrs.label}
{help}
); - } else if (['select', 'dropdown', 'selectdropdown'].includes(entry.type)) { + } else if (['select', 'dropdown', 'selectdropdown'].includes(componentAttrs.type)) { return (
- +
{help}
-
); } else { - entry.className = classList(['FormControl', entry.className]); + componentAttrs.className = classList(['FormControl', componentAttrs.className]); return (
- {entry.label ? : ''} + {componentAttrs.label ? : ''}
{help}
- +
); }