mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-26 17:29:53 +01:00
feat: bring back noskin option
if forum sets a default skin there was no way for the user to go back to the no skin version
This commit is contained in:
@@ -56,16 +56,8 @@ settingsController.get = async function (req, res, next) {
|
||||
{ value: 'biweek', name: '[[user:digest_biweekly]]', selected: userData.settings.dailyDigestFreq === 'biweek' },
|
||||
{ value: 'month', name: '[[user:digest_monthly]]', selected: userData.settings.dailyDigestFreq === 'month' },
|
||||
];
|
||||
userData.bootswatchSkinOptions = [
|
||||
{ name: 'Default', value: '' },
|
||||
];
|
||||
userData.bootswatchSkinOptions.push(
|
||||
...meta.css.supportedSkins.map(skin => ({ name: _.capitalize(skin), value: skin }))
|
||||
);
|
||||
|
||||
userData.bootswatchSkinOptions.forEach((skin) => {
|
||||
skin.selected = skin.value === userData.settings.bootswatchSkin;
|
||||
});
|
||||
getSkinOptions(userData);
|
||||
|
||||
userData.languages.forEach((language) => {
|
||||
language.selected = language.code === userData.settings.userLang;
|
||||
@@ -227,3 +219,18 @@ async function getHomePageRoutes(userData) {
|
||||
|
||||
return routes;
|
||||
}
|
||||
|
||||
function getSkinOptions(userData) {
|
||||
const defaultSkin = _.capitalize(meta.config.bootswatchSkin) || '[[user:no-skin]]';
|
||||
userData.bootswatchSkinOptions = [
|
||||
{ name: '[[user:no-skin]]', value: 'noskin' },
|
||||
{ name: `[[user:default, ${defaultSkin}]]`, value: '' },
|
||||
];
|
||||
userData.bootswatchSkinOptions.push(
|
||||
...meta.css.supportedSkins.map(skin => ({ name: _.capitalize(skin), value: skin }))
|
||||
);
|
||||
|
||||
userData.bootswatchSkinOptions.forEach((skin) => {
|
||||
skin.selected = skin.value === userData.settings.bootswatchSkin;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ apiController.loadConfig = async function (req) {
|
||||
}
|
||||
|
||||
// Handle old skin configs
|
||||
const oldSkins = ['noskin', 'default'];
|
||||
const oldSkins = ['default'];
|
||||
settings.bootswatchSkin = oldSkins.includes(settings.bootswatchSkin) ? '' : settings.bootswatchSkin;
|
||||
|
||||
config.usePagination = settings.usePagination;
|
||||
@@ -113,7 +113,14 @@ apiController.loadConfig = async function (req) {
|
||||
config.categoryTopicSort = settings.categoryTopicSort || config.categoryTopicSort;
|
||||
config.topicSearchEnabled = settings.topicSearchEnabled || false;
|
||||
config.disableCustomUserSkins = meta.config.disableCustomUserSkins === 1;
|
||||
config.bootswatchSkin = (meta.config.disableCustomUserSkins !== 1 && settings.bootswatchSkin && settings.bootswatchSkin !== '') ? settings.bootswatchSkin : '';
|
||||
config.defaultBootswatchSkin = config.bootswatchSkin;
|
||||
if (!config.disableCustomUserSkins && settings.bootswatchSkin) {
|
||||
if (settings.bootswatchSkin === 'noskin') {
|
||||
config.bootswatchSkin = '';
|
||||
} else if (settings.bootswatchSkin !== '') {
|
||||
config.bootswatchSkin = settings.bootswatchSkin;
|
||||
}
|
||||
}
|
||||
|
||||
// Overrides based on privilege
|
||||
config.disableChatMessageEditing = isAdminOrGlobalMod ? false : config.disableChatMessageEditing;
|
||||
|
||||
Reference in New Issue
Block a user