Add roles to UserDiff when encountering missing data

This commit is contained in:
NicolasCantu 2025-03-04 14:50:57 +01:00
parent b6c2d211e5
commit 570f98c51c

View File

@ -66,7 +66,7 @@ async function scanMissingData(processesToScan) {
if (!existingData) { if (!existingData) {
toDownload.add(hash); toDownload.add(hash);
// We also add an entry in diff, in case it doesn't already exist // We also add an entry in diff, in case it doesn't already exist
await addDiff(processId, state.state_id, hash, field); await addDiff(processId, state.state_id, hash, state.roles, field);
} else { } else {
// We remove it if we have it in the set // We remove it if we have it in the set
if (toDownload.delete(hash)) { if (toDownload.delete(hash)) {
@ -221,7 +221,7 @@ async function getBlob(hash) {
return result; return result;
} }
async function addDiff(processId, stateId, hash) { async function addDiff(processId, stateId, hash, roles, field) {
const db = await openDatabase(); const db = await openDatabase();
const storeName = 'diffs'; const storeName = 'diffs';
const tx = db.transaction(storeName, 'readwrite'); const tx = db.transaction(storeName, 'readwrite');
@ -239,7 +239,8 @@ async function addDiff(processId, stateId, hash) {
process_id: processId, process_id: processId,
state_id: stateId, state_id: stateId,
value_commitment: hash, value_commitment: hash,
field: '', roles: roles,
field: field,
description: null, description: null,
previous_value: null, previous_value: null,
new_value: null, new_value: null,