don't set date modified on erasing

This commit is contained in:
zadam 2019-12-03 19:10:40 +01:00
parent 749bb90713
commit 0e2f8b5734

View file

@ -462,39 +462,31 @@ async function eraseDeletedNotes() {
return; return;
} }
const utcNowDateTime = dateUtils.utcNowDateTime();
const localNowDateTime = dateUtils.localNowDateTime();
// it's better to not use repository for this because it will complain about saving protected notes // it's better to not use repository for this because it will complain about saving protected notes
// out of protected session // out of protected session, also we don't want these changes to be synced (since they are done on all instances anyway)
// setting contentLength to zero would serve no benefit and it leaves potentially useful trail // setting contentLength to zero would serve no benefit and it leaves potentially useful trail
await sql.executeMany(` await sql.executeMany(`
UPDATE notes UPDATE notes
SET isErased = 1, SET isErased = 1
utcDateModified = '${utcNowDateTime}',
dateModified = '${localNowDateTime}'
WHERE noteId IN (???)`, noteIdsToErase); WHERE noteId IN (???)`, noteIdsToErase);
await sql.executeMany(` await sql.executeMany(`
UPDATE note_contents UPDATE note_contents
SET content = NULL, SET content = NULL
utcDateModified = '${utcNowDateTime}'
WHERE noteId IN (???)`, noteIdsToErase); WHERE noteId IN (???)`, noteIdsToErase);
// deleting first contents since the WHERE relies on isErased = 0 // deleting first contents since the WHERE relies on isErased = 0
await sql.executeMany(` await sql.executeMany(`
UPDATE note_revision_contents UPDATE note_revision_contents
SET content = NULL, SET content = NULL
utcDateModified = '${utcNowDateTime}'
WHERE noteRevisionId IN WHERE noteRevisionId IN
(SELECT noteRevisionId FROM note_revisions WHERE isErased = 0 AND noteId IN (???))`, noteIdsToErase); (SELECT noteRevisionId FROM note_revisions WHERE isErased = 0 AND noteId IN (???))`, noteIdsToErase);
await sql.executeMany(` await sql.executeMany(`
UPDATE note_revisions UPDATE note_revisions
SET isErased = 1, SET isErased = 1,
title = NULL, title = NULL
utcDateModified = '${utcNowDateTime}'
WHERE isErased = 0 AND noteId IN (???)`, noteIdsToErase); WHERE isErased = 0 AND noteId IN (???)`, noteIdsToErase);
} }