Node.js based forum software built for the modern web
fix: #10739, always re-add theme to active plugins, on theme set
Julian Lam8d701ec3e2ae
diff --git a/src/meta/themes.js b/src/meta/themes.jsindex 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);