mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 21:30:30 +01:00
fix: #10739, always re-add theme to active plugins, on theme set
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user