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 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() isHashNew ||
.catch(() => null) _.isNil(currentConfigVersion) ||
.then( currentConfigVersion < settings.version
configVersion => const details = isVersionNew ? _.omit(['text'], latestTerms) : null
isHashNew ||
_.isNil(currentConfigVersion) || return { hash, details, text }
currentConfigVersion < configVersion,
)
.then(isVersionNew => (isVersionNew ? _.omit(['text'], latestTerms) : null))
.then(details => ({ hash, details, text }))
} }
module.exports = { module.exports = {