1
0
mirror of https://git.pleroma.social/sjw/pleroma-fe.git synced 2024-12-22 14:19:35 +01:00

fix themes v2 editor for anon users and people who never touched themes

This commit is contained in:
Henry Jameson 2024-07-17 22:25:14 +03:00
parent d2683a6728
commit 9d5514de9c
2 changed files with 16 additions and 8 deletions

View File

@ -42,6 +42,7 @@ const defaultState = {
registrationOpen: true,
server: 'http://localhost:4040/',
textlimit: 5000,
themeData: undefined, // used for theme editor v2
vapidPublicKey: undefined,
// Stuff from static/config.json

View File

@ -230,13 +230,6 @@ const interfaceMod = {
const forceRecompile = forceThemeRecompilation || recompile
// If we're not not forced to recompile try using
// cache (tryLoadCache return true if load successful)
if (!forceRecompile && !themeDebug && tryLoadCache()) {
commit('setThemeApplied')
return
}
let promise = null
if (themeData) {
@ -250,11 +243,25 @@ const interfaceMod = {
promise = Promise.resolve(normalizeThemeData(userThemeSnapshot))
}
} else if (actualThemeName && actualThemeName !== 'custom') {
promise = getPreset(actualThemeName).then(themeData => normalizeThemeData(themeData))
promise = getPreset(actualThemeName).then(themeData => {
const realThemeData = normalizeThemeData(themeData)
if (actualThemeName === instanceThemeName) {
// This sole line is the reason why this whole block is above the recompilation check
commit('setInstanceOption', { name: 'themeData', value: { theme: realThemeData } })
}
return realThemeData
})
} else {
throw new Error('Cannot load any theme!')
}
// If we're not not forced to recompile try using
// cache (tryLoadCache return true if load successful)
if (!forceRecompile && !themeDebug && tryLoadCache()) {
commit('setThemeApplied')
return
}
promise
.then(realThemeData => {
const theme2ruleset = convertTheme2To3(realThemeData)