commit: eb2975b64d849af6bdc327dabac34b8e6d952eae
parent 28ebb8b0ae3bca71a82532297715948a959fbe67
Author: HJ <30-hj@users.noreply.git.pleroma.social>
Date: Sun, 24 Jan 2021 10:36:03 +0000
Merge branch 'fix-p-themes' into 'develop'
Fix p's weird corrupt theme data crashing theme engine
See merge request pleroma/pleroma-fe!1334
Diffstat:
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js
@@ -242,9 +242,18 @@ export const generateShadows = (input, colors) => {
panelHeader: 'panel',
input: 'input'
}
- const inputShadows = input.shadows && !input.themeEngineVersion
- ? shadows2to3(input.shadows, input.opacity)
- : input.shadows || {}
+
+ const cleanInputShadows = Object.fromEntries(
+ Object.entries(input.shadows)
+ .map(([name, shadowSlot]) => [
+ name,
+ // defaulting color to black to avoid potential problems
+ shadowSlot.map(shadowDef => ({ color: '#000000', ...shadowDef }))
+ ])
+ )
+ const inputShadows = cleanInputShadows && !input.themeEngineVersion
+ ? shadows2to3(cleanInputShadows, input.opacity)
+ : cleanInputShadows || {}
const shadows = Object.entries({
...DEFAULT_SHADOWS,
...inputShadows