From 8d701ec3e2ae2203a82c96aa244d5b360cff6a7d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 5 Jul 2022 13:13:28 -0400 Subject: [PATCH] fix: #10739, always re-add theme to active plugins, on theme set --- src/meta/themes.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/meta/themes.js b/src/meta/themes.js index bed7249283..b769cf9e38 100644 --- a/src/meta/themes.js +++ b/src/meta/themes.js @@ -89,6 +89,10 @@ Themes.set = async (data) => { switch (data.type) { case 'local': { const current = await Meta.configs.get('theme:id'); + await db.sortedSetRemove('plugins:active', current); + const numPlugins = await db.sortedSetCard('plugins:active'); + await db.sortedSetAdd('plugins:active', numPlugins, data.id); + if (current !== data.id) { const pathToThemeJson = path.join(nconf.get('themes_path'), data.id, 'theme.json'); if (!pathToThemeJson.startsWith(nconf.get('themes_path'))) { @@ -98,9 +102,6 @@ Themes.set = async (data) => { let config = await fs.promises.readFile(pathToThemeJson, 'utf8'); config = JSON.parse(config); - await db.sortedSetRemove('plugins:active', current); - const numPlugins = await db.sortedSetCard('plugins:active'); - await db.sortedSetAdd('plugins:active', numPlugins, data.id); // Re-set the themes path (for when NodeBB is reloaded) Themes.setPath(config);