diff --git a/app/soapbox/features/edit_profile/index.js b/app/soapbox/features/edit_profile/index.js index 35c2024f4..cf0e403d0 100644 --- a/app/soapbox/features/edit_profile/index.js +++ b/app/soapbox/features/edit_profile/index.js @@ -29,11 +29,9 @@ const messages = defineMessages({ const mapStateToProps = state => { const me = state.get('me'); - const maxFields = state.getIn(['instance', 'pleroma', 'metadata', 'fields_limits', 'max_fields']) ? - state.getIn(['instance', 'pleroma', 'metadata', 'fields_limits', 'max_fields']) : state.getIn(['instance', 'pleroma', 'metadata', 'fieldsLimits', 'maxFields']); return { account: state.getIn(['accounts', me]), - maxFields: maxFields, + maxFields: state.getIn(['instance', 'pleroma', 'metadata', 'fields_limits', 'max_fields'], 4), }; }; diff --git a/app/soapbox/reducers/instance.js b/app/soapbox/reducers/instance.js index 549f95207..f2fc6b5ca 100644 --- a/app/soapbox/reducers/instance.js +++ b/app/soapbox/reducers/instance.js @@ -12,7 +12,9 @@ const nodeinfoToInstance = nodeinfo => { account_activation_required: nodeinfo.getIn(['metadata', 'accountActivationRequired']), features: nodeinfo.getIn(['metadata', 'features']), federation: nodeinfo.getIn(['metadata', 'federation']), - fieldsLimits: nodeinfo.getIn(['metadata', 'fieldsLimits']), + fields_limits: ImmutableMap({ + max_fields: nodeinfo.getIn(['metadata', 'fieldsLimits', 'maxFields']), + }), }), }), }); @@ -32,9 +34,9 @@ const initialState = ImmutableMap({ export default function instance(state = initialState, action) { switch(action.type) { case INSTANCE_FETCH_SUCCESS: - return initialState.merge(fromJS(action.instance)); + return initialState.mergeDeep(fromJS(action.instance)); case NODEINFO_FETCH_SUCCESS: - return nodeinfoToInstance(fromJS(action.nodeinfo)).merge(state); + return nodeinfoToInstance(fromJS(action.nodeinfo)).mergeDeep(state); default: return state; }