From 9ebec8c178c6bbc074d72d7f003b2c98f0d6f1c4 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Wed, 8 Sep 2021 10:32:44 +0100 Subject: [PATCH] Cli: Fixes #5435: Setting note contents using "set" command does not update note timestamp --- packages/app-cli/app/command-set.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/app-cli/app/command-set.js b/packages/app-cli/app/command-set.js index 083c8d077..17ad9eaa8 100644 --- a/packages/app-cli/app/command-set.js +++ b/packages/app-cli/app/command-set.js @@ -34,18 +34,19 @@ class Command extends BaseCommand { for (let i = 0; i < notes.length; i++) { this.encryptionCheck(notes[i]); + const timestamp = Date.now(); + const newNote = { id: notes[i].id, type_: notes[i].type_, + updated_time: timestamp, }; newNote[propName] = propValue; - const timestamp = Date.now(); + if (!newNote.id) newNote.created_time = timestamp; await Note.save(newNote, { autoTimestamp: false, // No auto-timestamp because user may have provided them - updated_time: timestamp, - created_time: timestamp, }); } }