updatechecker: deep compare update object from appstore

When 'changelog' , 'unstable' fields change the box code is not
getting it.
This commit is contained in:
Girish Ramakrishnan
2024-04-16 19:29:06 +02:00
parent 1cf315634c
commit a572374ad7
2 changed files with 5 additions and 3 deletions

View File

@@ -14,7 +14,8 @@ const apps = require('./apps.js'),
debug = require('debug')('box:updatechecker'),
notifications = require('./notifications.js'),
paths = require('./paths.js'),
safe = require('safetydance');
safe = require('safetydance'),
util = require('util');
function setUpdateInfo(state) {
// appid -> update info { creationDate, manifest }
@@ -75,12 +76,12 @@ async function checkBoxUpdates(options) {
return;
}
if (state.box && state.box.version === updateInfo.version) {
if (util.isDeepStrictEqual(state.box, updateInfo)) {
debug(`checkBoxUpdates: Skipping notification of box update ${updateInfo.version} as user was already notified`);
return;
}
debug(`checkBoxUpdates: ${updateInfo.version} is available`);
debug(`checkBoxUpdates: ${updateInfo.version} is available. renotification: ${!!state.box}`);
const changelog = updateInfo.changelog.map((m) => `* ${m}\n`).join('');
const message = `Changelog:\n${changelog}\n\nGo to the settings view to update.\n\n`;