From e21fb9ccacb419132e7f37f0808c69f05df08060 Mon Sep 17 00:00:00 2001 From: Luciano Gorza <103193307+lucianogorza@users.noreply.github.com> Date: Tue, 28 Nov 2023 17:04:12 -0300 Subject: [PATCH] Fix last_check_date mapping when check updates service is disabled (#6171) --- .../server/services/updates/get-updates.ts | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts index c6fcdbcdf5..7f1cf39312 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts @@ -6,7 +6,6 @@ import { import { SAVED_OBJECT_UPDATES } from '../../../common/constants'; import { getSavedObject, setSavedObject } from '../saved-object'; import { getWazuhCore } from '../../plugin-services'; -import _ from 'lodash'; export const getUpdates = async (checkAvailableUpdates?: boolean): Promise => { try { @@ -43,15 +42,24 @@ export const getUpdates = async (checkAvailableUpdates?: boolean): Promise { - if (update?.update_check === false) { + if (update_check === false) { return API_UPDATES_STATUS.DISABLED; } if ( - update?.last_available_patch?.tag || - update?.last_available_minor?.tag || - update?.last_available_patch?.tag + last_available_major?.tag || + last_available_minor?.tag || + last_available_patch?.tag ) { return API_UPDATES_STATUS.AVAILABLE_UPDATES; } @@ -59,10 +67,13 @@ export const getUpdates = async (checkAvailableUpdates?: boolean): Promise