refactor: use configs version from configs object
This commit is contained in:
parent
430ca16cc5
commit
afae156ef9
1 changed files with 7 additions and 12 deletions
|
|
@ -5,7 +5,6 @@ const nmd = require('nano-markdown')
|
||||||
|
|
||||||
const plugins = require('../plugins')
|
const plugins = require('../plugins')
|
||||||
const configManager = require('../new-config-manager')
|
const configManager = require('../new-config-manager')
|
||||||
const settingsLoader = require('../new-settings-loader')
|
|
||||||
const {
|
const {
|
||||||
batchGetCustomInfoRequest,
|
batchGetCustomInfoRequest,
|
||||||
getCustomInfoRequests,
|
getCustomInfoRequests,
|
||||||
|
|
@ -411,17 +410,13 @@ const terms = (parent, { currentConfigVersion, currentHash }, { settings }) => {
|
||||||
const isHashNew = hash !== currentHash
|
const isHashNew = hash !== currentHash
|
||||||
const text = isHashNew ? latestTerms.text : null
|
const text = isHashNew ? latestTerms.text : null
|
||||||
|
|
||||||
return settingsLoader
|
const isVersionNew =
|
||||||
.fetchCurrentConfigVersion()
|
|
||||||
.catch(() => null)
|
|
||||||
.then(
|
|
||||||
configVersion =>
|
|
||||||
isHashNew ||
|
isHashNew ||
|
||||||
_.isNil(currentConfigVersion) ||
|
_.isNil(currentConfigVersion) ||
|
||||||
currentConfigVersion < configVersion,
|
currentConfigVersion < settings.version
|
||||||
)
|
const details = isVersionNew ? _.omit(['text'], latestTerms) : null
|
||||||
.then(isVersionNew => (isVersionNew ? _.omit(['text'], latestTerms) : null))
|
|
||||||
.then(details => ({ hash, details, text }))
|
return { hash, details, text }
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue