From df59ef9942a950a1c5437c69b1af4111f8c07817 Mon Sep 17 00:00:00 2001 From: kumavis Date: Mon, 2 Oct 2017 13:44:11 -0700 Subject: [PATCH] tx state history - append note to first op of diff --- app/scripts/lib/tx-state-history-helper.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/scripts/lib/tx-state-history-helper.js b/app/scripts/lib/tx-state-history-helper.js index 304069d57..ecf0d076e 100644 --- a/app/scripts/lib/tx-state-history-helper.js +++ b/app/scripts/lib/tx-state-history-helper.js @@ -20,8 +20,11 @@ function migrateFromSnapshotsToDiffs(longHistory) { ) } -function generateHistoryEntry(previousState, newState) { - return jsonDiffer.compare(previousState, newState) +function generateHistoryEntry(previousState, newState, note) { + const entry = jsonDiffer.compare(previousState, newState) + // Add a note to the first op, since it breaks if we append it to the entry + if (note && entry[0]) entry[0].note = note + return entry } function replayHistory(shortHistory) {