fix: #10739, always re-add theme to active plugins, on theme set

isekai-main
Julian Lam 3 years ago
parent d3ef4fa0cd
commit 8d701ec3e2

@ -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);

Loading…
Cancel
Save