Merge pull request #1703 from RafaelTaranto/fix/sumsub-small-issues
LAM-1134 fix: sumsub UI and cache invalidation on l-s
This commit is contained in:
commit
597d4a030b
3 changed files with 22 additions and 7 deletions
|
|
@ -100,7 +100,9 @@ const populateSettings = function (req, res, next) {
|
||||||
|
|
||||||
return newSettingsLoader.loadLatest()
|
return newSettingsLoader.loadLatest()
|
||||||
.then(settings => {
|
.then(settings => {
|
||||||
|
const versionId = settings.version
|
||||||
settingsCache.set(`${operatorId}-latest`, settings)
|
settingsCache.set(`${operatorId}-latest`, settings)
|
||||||
|
settingsCache.set(`${operatorId}-v${versionId}`, settings)
|
||||||
if (!!needsSettingsReload[operatorId]) delete needsSettingsReload[operatorId]
|
if (!!needsSettingsReload[operatorId]) delete needsSettingsReload[operatorId]
|
||||||
req.settings = settings
|
req.settings = settings
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -151,10 +151,11 @@ function resetConfig (schemaVersion) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadLatest (schemaVersion) {
|
function loadLatest (schemaVersion) {
|
||||||
return Promise.all([loadLatestConfigOrNone(schemaVersion), loadAccounts(schemaVersion)])
|
return Promise.all([loadLatestConfigOrNoneReturningVersion(schemaVersion), loadAccounts(schemaVersion)])
|
||||||
.then(([config, accounts]) => ({
|
.then(([configObj, accounts]) => ({
|
||||||
config,
|
config: configObj.config,
|
||||||
accounts
|
accounts,
|
||||||
|
version: configObj.version
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,6 +175,18 @@ function loadLatestConfig () {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadLatestConfigOrNoneReturningVersion (schemaVersion) {
|
||||||
|
const sql = `select data, id
|
||||||
|
from user_config
|
||||||
|
where type=$1
|
||||||
|
and schema_version=$2
|
||||||
|
order by id desc
|
||||||
|
limit 1`
|
||||||
|
|
||||||
|
return db.oneOrNone(sql, ['config', schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||||
|
.then(row => row ? { config: row.data.config, version: row.id } : {})
|
||||||
|
}
|
||||||
|
|
||||||
function loadLatestConfigOrNone (schemaVersion) {
|
function loadLatestConfigOrNone (schemaVersion) {
|
||||||
const sql = `select data
|
const sql = `select data
|
||||||
from user_config
|
from user_config
|
||||||
|
|
|
||||||
|
|
@ -557,7 +557,7 @@ const requirementOptions = [
|
||||||
// { display: 'Super user', code: 'superuser' },
|
// { display: 'Super user', code: 'superuser' },
|
||||||
{ display: 'Suspend', code: 'suspend' },
|
{ display: 'Suspend', code: 'suspend' },
|
||||||
{ display: 'Block', code: 'block' },
|
{ display: 'Block', code: 'block' },
|
||||||
{ display: 'External Verification', code: 'external' }
|
{ display: 'External verification', code: 'external' }
|
||||||
]
|
]
|
||||||
|
|
||||||
const hasRequirementError = (errors, touched, values) =>
|
const hasRequirementError = (errors, touched, values) =>
|
||||||
|
|
@ -640,7 +640,7 @@ const Requirement = ({
|
||||||
|
|
||||||
const titleClass = {
|
const titleClass = {
|
||||||
[classes.error]:
|
[classes.error]:
|
||||||
(!!errors.requirement && !isSuspend && !isCustom) ||
|
(!!errors.requirement && !isSuspend && !isCustom && !isExternal) ||
|
||||||
(isSuspend && hasRequirementError(errors, touched, values)) ||
|
(isSuspend && hasRequirementError(errors, touched, values)) ||
|
||||||
(isCustom && hasCustomRequirementError(errors, touched, values)) ||
|
(isCustom && hasCustomRequirementError(errors, touched, values)) ||
|
||||||
(isExternal && hasExternalRequirementError(errors, touched, values))
|
(isExternal && hasExternalRequirementError(errors, touched, values))
|
||||||
|
|
@ -804,7 +804,7 @@ const RequirementView = ({
|
||||||
R.find(customReqIdMatches(customInfoRequestId))(customInfoRequests)
|
R.find(customReqIdMatches(customInfoRequestId))(customInfoRequests)
|
||||||
) ?? ''
|
) ?? ''
|
||||||
: requirement === 'external'
|
: requirement === 'external'
|
||||||
? `External Verification (${onlyFirstToUpper(externalService)})`
|
? `External verification (${onlyFirstToUpper(externalService)})`
|
||||||
: getView(requirementOptions, 'display')(requirement)
|
: getView(requirementOptions, 'display')(requirement)
|
||||||
const isSuspend = requirement === 'suspend'
|
const isSuspend = requirement === 'suspend'
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue