Merge branch 'blue_flicker' into 'develop'

Apply non-blank default BrandColor only on failure to acquire brandColor. Fixes #364

Closes #364

See merge request soapbox-pub/soapbox-fe!198
better-thread-display
Alex Gleason 2020-09-03 16:29:51 +00:00
commit f9a0ce1d6b
2 zmienionych plików z 14 dodań i 2 usunięć

Wyświetl plik

@ -7,7 +7,7 @@ export const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL';
export const defaultConfig = ImmutableMap({
logo: '',
banner: '',
brandColor: '#0482d8', // Azure
brandColor: '', // Empty
customCss: ImmutableList(),
promoPanel: ImmutableMap({
items: ImmutableList(),
@ -50,6 +50,9 @@ export function fetchSoapboxJson() {
}
export function importSoapboxConfig(soapboxConfig) {
if (!soapboxConfig.brandColor) {
soapboxConfig.brandColor = '#0482d8';
};
return {
type: SOAPBOX_CONFIG_REQUEST_SUCCESS,
soapboxConfig,

Wyświetl plik

@ -1,10 +1,17 @@
import { ADMIN_CONFIG_UPDATE_SUCCESS } from '../actions/admin';
import { SOAPBOX_CONFIG_REQUEST_SUCCESS } from '../actions/soapbox';
import {
SOAPBOX_CONFIG_REQUEST_SUCCESS,
SOAPBOX_CONFIG_REQUEST_FAIL,
} from '../actions/soapbox';
import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable';
import { ConfigDB } from 'soapbox/utils/config_db';
const initialState = ImmutableMap();
const fallbackState = ImmutableMap({
brandColor: '#0482d8', // Azure
});
const updateFromAdmin = (state, config) => {
const configs = config.get('configs', ImmutableList());
@ -22,6 +29,8 @@ export default function soapbox(state = initialState, action) {
switch(action.type) {
case SOAPBOX_CONFIG_REQUEST_SUCCESS:
return fromJS(action.soapboxConfig);
case SOAPBOX_CONFIG_REQUEST_FAIL:
return fallbackState.mergeDeep(state);
case ADMIN_CONFIG_UPDATE_SUCCESS:
return updateFromAdmin(state, fromJS(action.config));
default: