From c8e0fe105fd001781d56c1c52e716e266e4622d1 Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Tue, 29 Oct 2024 22:17:18 -0700 Subject: [PATCH] Fixes record change history handler when FF is off --- src/models/common/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/models/common/index.js b/src/models/common/index.js index abc3990..fe0510a 100644 --- a/src/models/common/index.js +++ b/src/models/common/index.js @@ -78,7 +78,8 @@ export async function recordHistory(modifiedField, oldDocument, newDocument, dom const diff = { oldValues: new Map(), newValues: new Map() }; const documents = { oldDocument, newDocument }; - if (!await checkHistory(domainId) || process.env.HISTORY_ACTIVATED !== 'true') { + const featureFlag = await checkHistory(domainId); + if (!featureFlag.result || process.env.HISTORY_ACTIVATED !== 'true') { return undefined; } @@ -101,7 +102,7 @@ export async function recordHistory(modifiedField, oldDocument, newDocument, dom updatedBy: newDocument.updatedBy, date: Date.now() }); - + return history.save(); }