refactor: use configs version from configs object

This commit is contained in:
siiky 2025-06-12 15:47:52 +01:00
parent 430ca16cc5
commit afae156ef9

View file

@ -5,7 +5,6 @@ const nmd = require('nano-markdown')
const plugins = require('../plugins')
const configManager = require('../new-config-manager')
const settingsLoader = require('../new-settings-loader')
const {
batchGetCustomInfoRequest,
getCustomInfoRequests,
@ -411,17 +410,13 @@ const terms = (parent, { currentConfigVersion, currentHash }, { settings }) => {
const isHashNew = hash !== currentHash
const text = isHashNew ? latestTerms.text : null
return settingsLoader
.fetchCurrentConfigVersion()
.catch(() => null)
.then(
configVersion =>
isHashNew ||
_.isNil(currentConfigVersion) ||
currentConfigVersion < configVersion,
)
.then(isVersionNew => (isVersionNew ? _.omit(['text'], latestTerms) : null))
.then(details => ({ hash, details, text }))
const isVersionNew =
isHashNew ||
_.isNil(currentConfigVersion) ||
currentConfigVersion < settings.version
const details = isVersionNew ? _.omit(['text'], latestTerms) : null
return { hash, details, text }
}
module.exports = {