refactor: remove admin.themes.getInstalled

socket call, and just load the themes in the api call
This commit is contained in:
Barış Soner Uşaklı
2026-02-28 12:25:29 -05:00
parent f97484c201
commit 92d72f6745
7 changed files with 42 additions and 40 deletions

View File

@@ -1,9 +1,12 @@
'use strict';
const meta = require('../../meta');
const appearanceController = module.exports;
appearanceController.themes = function (req, res) {
res.render(`admin/appearance/themes`, {});
appearanceController.themes = async function (req, res) {
const themes = await meta.themes.get();
res.render(`admin/appearance/themes`, { themes });
};
appearanceController.skins = function (req, res) {

View File

@@ -115,7 +115,6 @@ privsAdmin.socketMap = {
'admin.getSearchDict': 'admin:settings',
'admin.config.setMultiple': 'admin:settings',
'admin.config.remove': 'admin:settings',
'admin.themes.getInstalled': 'admin:settings',
'admin.themes.set': 'admin:settings',
'admin.reloadAllSessions': 'admin:settings',
'admin.settings.get': 'admin:settings',

View File

@@ -5,10 +5,6 @@ const widgets = require('../../widgets');
const Themes = module.exports;
Themes.getInstalled = async function () {
return await meta.themes.get();
};
Themes.set = async function (socket, data) {
if (!data) {
throw new Error('[[error:invalid-data]]');

View File

@@ -10,7 +10,11 @@
<div id="themes" class="themes px-2">
<div class="directory row text-center" id="installed_themes">
<i class="fa fa-refresh fa-spin"></i> [[admin/appearance/themes:checking-for-installed]]
{{{ if themes.length }}}
<!-- IMPORT admin/partials/theme_list.tpl -->
{{{ else }}}
<div class="alert alert-info no-themes">[[admin/appearance/themes:no-themes]]</div>
{{{ end}}}
</div>
</div>
</div>