remove edge cases from server side

This commit is contained in:
Josh Harvey 2017-05-10 20:43:53 +03:00
parent c2282e61b4
commit a60a4f8793
2 changed files with 281 additions and 239 deletions

View file

@ -165,18 +165,6 @@ function configDeleteField (scope, fieldCode) {
}
}
function addEdgeCases (config) {
const isCashOutEnabled = r => r.fieldLocator.fieldScope.machine !== 'global' &&
r.fieldLocator.code === 'cashOutEnabled' &&
r.fieldValue.value
const cashOutEnabledExists = _.some(isCashOutEnabled, config)
const scope = {crypto: 'global', machine: 'global'}
const newField = configAddField(scope, 'cashOutEnabled', cashOutEnabledExists)
return mergeValues(config, newField)
}
function modifyConfig (newFields) {
const TransactionMode = pgp.txMode.TransactionMode
const isolationLevel = pgp.txMode.isolationLevel
@ -185,7 +173,7 @@ function modifyConfig (newFields) {
function transaction (t) {
return loadRecentConfig()
.then(oldConfig => {
const doSave = _.flow(mergeValues, addEdgeCases, save)
const doSave = _.flow(mergeValues, save)
return doSave(oldConfig, newFields)
})
}

File diff suppressed because it is too large Load diff