sforkowany z mirror/soapbox
Admin: optimistic RegistrationModePicker
rodzic
b571765c33
commit
acdc282cfd
|
@ -3,7 +3,7 @@ import {
|
||||||
NODEINFO_FETCH_SUCCESS,
|
NODEINFO_FETCH_SUCCESS,
|
||||||
} from '../actions/instance';
|
} from '../actions/instance';
|
||||||
import { PRELOAD_IMPORT } from 'soapbox/actions/preload';
|
import { PRELOAD_IMPORT } from 'soapbox/actions/preload';
|
||||||
import { ADMIN_CONFIG_UPDATE_SUCCESS } from 'soapbox/actions/admin';
|
import { ADMIN_CONFIG_UPDATE_REQUEST, ADMIN_CONFIG_UPDATE_SUCCESS } from 'soapbox/actions/admin';
|
||||||
import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable';
|
import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable';
|
||||||
import { ConfigDB } from 'soapbox/utils/config_db';
|
import { ConfigDB } from 'soapbox/utils/config_db';
|
||||||
|
|
||||||
|
@ -40,9 +40,10 @@ const preloadImport = (state, action, path) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getConfigValue = (instanceConfig, key) => {
|
const getConfigValue = (instanceConfig, key) => {
|
||||||
return instanceConfig
|
const v = instanceConfig
|
||||||
.find(value => value.getIn(['tuple', 0]) === key)
|
.find(value => value.getIn(['tuple', 0]) === key);
|
||||||
.getIn(['tuple', 1]);
|
|
||||||
|
return v ? v.getIn(['tuple', 1]) : undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
const importConfigs = (state, configs) => {
|
const importConfigs = (state, configs) => {
|
||||||
|
@ -68,6 +69,7 @@ export default function instance(state = initialState, action) {
|
||||||
return initialState.mergeDeep(fromJS(action.instance));
|
return initialState.mergeDeep(fromJS(action.instance));
|
||||||
case NODEINFO_FETCH_SUCCESS:
|
case NODEINFO_FETCH_SUCCESS:
|
||||||
return nodeinfoToInstance(fromJS(action.nodeinfo)).mergeDeep(state);
|
return nodeinfoToInstance(fromJS(action.nodeinfo)).mergeDeep(state);
|
||||||
|
case ADMIN_CONFIG_UPDATE_REQUEST:
|
||||||
case ADMIN_CONFIG_UPDATE_SUCCESS:
|
case ADMIN_CONFIG_UPDATE_SUCCESS:
|
||||||
return importConfigs(state, fromJS(action.configs));
|
return importConfigs(state, fromJS(action.configs));
|
||||||
default:
|
default:
|
||||||
|
|
Ładowanie…
Reference in New Issue