kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Apply non-blank default BrandColor only when API and soapbox.json methods fail, and only when API and/or JSON method succeeds, but brandColor value is blank
rodzic
c8e6bd9540
commit
b337a4560e
|
@ -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(),
|
||||
|
@ -48,7 +48,13 @@ export function fetchSoapboxJson() {
|
|||
};
|
||||
}
|
||||
|
||||
export function importSoapboxConfig(soapboxConfig) {
|
||||
export function importSoapboxConfig(soapboxConfig, getIn) {
|
||||
if(soapboxConfig.get('brandColor') === '') {
|
||||
const defaultBrandColor = ImmutableMap({
|
||||
brandColor: '#0482d8', // Azure
|
||||
});
|
||||
defaultBrandColor.mergeDeep(soapboxConfig);
|
||||
};
|
||||
return {
|
||||
type: SOAPBOX_CONFIG_REQUEST_SUCCESS,
|
||||
soapboxConfig,
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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';
|
||||
|
||||
|
@ -22,6 +25,11 @@ export default function soapbox(state = initialState, action) {
|
|||
switch(action.type) {
|
||||
case SOAPBOX_CONFIG_REQUEST_SUCCESS:
|
||||
return fromJS(action.soapboxConfig);
|
||||
case SOAPBOX_CONFIG_REQUEST_FAIL:
|
||||
const defaultBrandColor = ImmutableMap({
|
||||
brandColor: '#0482d8', // Azure
|
||||
});
|
||||
return defaultBrandColor.mergeDeep(state.get('soapbox'));
|
||||
case ADMIN_CONFIG_UPDATE_SUCCESS:
|
||||
return updateFromAdmin(state, fromJS(action.config));
|
||||
default:
|
||||
|
|
Ładowanie…
Reference in New Issue