diff --git a/app/soapbox/actions/soapbox.js b/app/soapbox/actions/soapbox.js index 71396aa0a..a0f5ad277 100644 --- a/app/soapbox/actions/soapbox.js +++ b/app/soapbox/actions/soapbox.js @@ -4,8 +4,8 @@ export const SOAPBOX_CONFIG_REQUEST_SUCCESS = 'SOAPBOX_CONFIG_REQUEST_SUCCESS'; export const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL'; export const SOAPBOX_POST_REQUEST = 'SOAPBOX_POST_REQUEST'; -export const SOAPBOX_POST_SUCCESS = 'SOAPBOX_POST_REQUEST'; -export const SOAPBOX_POST_FAIL = 'SOAPBOX_POST_REQUEST'; +export const SOAPBOX_POST_SUCCESS = 'SOAPBOX_POST_SUCCESS'; +export const SOAPBOX_POST_FAIL = 'SOAPBOX_POST_FAIL'; export function fetchSoapboxConfig() { return (dispatch, getState) => { diff --git a/app/soapbox/features/configuration/index.js b/app/soapbox/features/configuration/index.js index 34035754a..c5218c8df 100644 --- a/app/soapbox/features/configuration/index.js +++ b/app/soapbox/features/configuration/index.js @@ -113,7 +113,7 @@ class ConfigSoapbox extends ImmutablePureComponent { } getParams = () => { - // const { state } = this; + const { state } = this; var obj = { configs: [{ group: ':pleroma', @@ -121,46 +121,44 @@ class ConfigSoapbox extends ImmutablePureComponent { value: [{ tuple: [':soapbox_fe', { - // logo: '', - // banner: '', - // brandColor: '', - // customCss: [], - // promoPanel: { - // items: [], - // }, - // extensions: { - // patron: false, - // }, - // defaultSettings: { - // autoPlayGif: false, - // }, - // copyright: '', - // navlinks: { - // homeFooter: [], - // }, + logo: '', + banner: '', + brandColor: '', + customCss: [], + promoPanel: { + items: [], + }, + extensions: { + patron: false, + }, + defaultSettings: { + autoPlayGif: false, + }, + copyright: '', + navlinks: { + homeFooter: [], + }, }, ], }], }], }; - // obj.configs[0].value[0].tuple[1].logo = state.logo; - // obj.configs[0].value[0].tuple[1].banner = state.banner; - // obj.configs[0].value[0].tuple[1].brandColor = state.brandColor; - // obj.configs[0].value[0].tuple[1].extensions.patron = state.patronEnabled; - // obj.configs[0].value[0].tuple[1].defaultSettings.autoPlayGif = state.autoPlayGif; - // obj.configs[0].value[0].tuple[1].copyright = state.copyright; - // this.state.homeFooterItems.forEach((f) => - // obj.configs[0].value[0].tuple[1].navlinks.homeFooter.push({ title: f.get('title'), url: f.get('url') }) - // ); - // this.state.promoItems.forEach((f) => - // obj.configs[0].value[0].tuple[1].promoPanel.items.push({ icon: f.get('icon'), text: f.get('text'), url: f.get('url') }) - // ); - // this.state.customCssItems.forEach((f) => - // obj.configs[0].value[0].tuple[1].customCss.push(f) - // ); - console.log(JSON.stringify(obj, null, 2)); - // console.log(JSON.stringify(obj.configs[0].value[0].tuple[1], null, 2)); - return JSON.stringify(obj); + obj.configs[0].value[0].tuple[1].logo = state.logo; + obj.configs[0].value[0].tuple[1].banner = state.banner; + obj.configs[0].value[0].tuple[1].brandColor = state.brandColor; + obj.configs[0].value[0].tuple[1].extensions.patron = state.patronEnabled; + obj.configs[0].value[0].tuple[1].defaultSettings.autoPlayGif = state.autoPlayGif; + obj.configs[0].value[0].tuple[1].copyright = state.copyright; + this.state.homeFooterItems.forEach((f) => + obj.configs[0].value[0].tuple[1].navlinks.homeFooter.push({ title: f.get('title'), url: f.get('url') }) + ); + this.state.promoItems.forEach((f) => + obj.configs[0].value[0].tuple[1].promoPanel.items.push({ icon: f.get('icon'), text: f.get('text'), url: f.get('url') }) + ); + this.state.customCssItems.forEach((f) => + obj.configs[0].value[0].tuple[1].customCss.push(f) + ); + return obj; } handleSubmit = (event) => { diff --git a/app/soapbox/reducers/soapbox.js b/app/soapbox/reducers/soapbox.js index c6101abdf..6e9dbf5e5 100644 --- a/app/soapbox/reducers/soapbox.js +++ b/app/soapbox/reducers/soapbox.js @@ -2,7 +2,6 @@ import { SOAPBOX_CONFIG_REQUEST_SUCCESS, SOAPBOX_CONFIG_REQUEST_FAIL, SOAPBOX_POST_SUCCESS, - SOAPBOX_POST_REQUEST, } from '../actions/soapbox'; import { Map as ImmutableMap, fromJS } from 'immutable'; @@ -18,11 +17,8 @@ export default function soapbox(state = initialState, action) { return defaultState.merge(ImmutableMap(fromJS(action.soapboxConfig))); case SOAPBOX_CONFIG_REQUEST_FAIL: return defaultState; - case SOAPBOX_POST_REQUEST: case SOAPBOX_POST_SUCCESS: - // const soapbox = ImmutableMap(fromJS(action.soapboxConfig)).configs[0].value[0].tuple[1]; - // return soapbox; - return defaultState; + return defaultState.merge(ImmutableMap(fromJS(action.soapboxConfig.configs[0].value[0].tuple[1]))); default: return state; }