Handle max_fields
fallback differently
This commit is contained in:
parent
9c505d0d84
commit
2fff5db5d5
2 changed files with 6 additions and 6 deletions
|
@ -29,11 +29,9 @@ const messages = defineMessages({
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const me = state.get('me');
|
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 {
|
return {
|
||||||
account: state.getIn(['accounts', me]),
|
account: state.getIn(['accounts', me]),
|
||||||
maxFields: maxFields,
|
maxFields: state.getIn(['instance', 'pleroma', 'metadata', 'fields_limits', 'max_fields'], 4),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,9 @@ const nodeinfoToInstance = nodeinfo => {
|
||||||
account_activation_required: nodeinfo.getIn(['metadata', 'accountActivationRequired']),
|
account_activation_required: nodeinfo.getIn(['metadata', 'accountActivationRequired']),
|
||||||
features: nodeinfo.getIn(['metadata', 'features']),
|
features: nodeinfo.getIn(['metadata', 'features']),
|
||||||
federation: nodeinfo.getIn(['metadata', 'federation']),
|
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) {
|
export default function instance(state = initialState, action) {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case INSTANCE_FETCH_SUCCESS:
|
case INSTANCE_FETCH_SUCCESS:
|
||||||
return initialState.merge(fromJS(action.instance));
|
return initialState.mergeDeep(fromJS(action.instance));
|
||||||
case NODEINFO_FETCH_SUCCESS:
|
case NODEINFO_FETCH_SUCCESS:
|
||||||
return nodeinfoToInstance(fromJS(action.nodeinfo)).merge(state);
|
return nodeinfoToInstance(fromJS(action.nodeinfo)).mergeDeep(state);
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue