logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: e029732021f67e13ca20c1b80c1315c4935b9f2b
parent cd92eb56e097cbc9a42b31ceb9cf2f0bd94967db
Author: Henry Jameson <me@hjkos.com>
Date:   Fri, 12 Jul 2024 02:40:57 +0300

use separate action for setting Theme V2

Diffstat:

Msrc/components/settings_modal/tabs/theme_tab/theme_tab.js12++++--------
Msrc/modules/config.js11++++++-----
Msrc/modules/interface.js2--
3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/src/components/settings_modal/tabs/theme_tab/theme_tab.js b/src/components/settings_modal/tabs/theme_tab/theme_tab.js @@ -499,18 +499,14 @@ export default { } }, setCustomTheme () { - this.$store.dispatch('setOption', { - name: 'customTheme', - value: { + this.$store.dispatch('setThemeV2', { + customTheme: { ignore: true, themeFileVersion: this.selectedVersion, themeEngineVersion: CURRENT_VERSION, ...this.previewTheme - } - }) - this.$store.dispatch('setOption', { - name: 'customThemeSource', - value: { + }, + customThemeSource: { themeFileVersion: this.selectedVersion, themeEngineVersion: CURRENT_VERSION, shadows: this.shadowsLocal, diff --git a/src/modules/config.js b/src/modules/config.js @@ -255,6 +255,11 @@ const config = { revert }) }, + setThemeV2 ({ commit, dispatch }, { customTheme, customThemeSource }) { + commit('setOption', { name: 'customTheme', value: customTheme }) + commit('setOption', { name: 'customThemeSource', value: customThemeSource }) + dispatch('setTheme', { themeData: customThemeSource, recompile: true }) + }, setOption ({ commit, dispatch, state }, { name, value }) { const exceptions = new Set([ 'useStreamingApi' @@ -272,6 +277,7 @@ const config = { dispatch('disableMastoSockets') dispatch('setOption', { name: 'useStreamingApi', value: false }) }) + break } } } else { @@ -286,11 +292,6 @@ const config = { case 'theme': dispatch('setTheme', { themeName: value, recompile: true }) break - case 'customTheme': - case 'customThemeSource': { - if (!value.ignore) dispatch('setTheme', { themeData: value }) - break - } case 'themeDebug': { dispatch('setTheme', { recompile: true }) break diff --git a/src/modules/interface.js b/src/modules/interface.js @@ -255,10 +255,8 @@ const interfaceMod = { let promise = null if (themeName) { - // commit('setInstanceOption', { name: 'theme', value: themeName }) promise = getPreset(themeName) .then(themeData => { - // commit('setInstanceOption', { name: 'themeData', value: themeData }) return normalizeThemeData(themeData) }) } else if (themeData) {