From 6475a8e34369deb42ec2a4cc506f4da7cdc37023 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 16 Sep 2020 10:32:39 +0300 Subject: [PATCH] Migration: add a warning about mtime missing when migrating. --- src/MigrateV2.tsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/MigrateV2.tsx b/src/MigrateV2.tsx index cf95ea9..df68d97 100644 --- a/src/MigrateV2.tsx +++ b/src/MigrateV2.tsx @@ -405,6 +405,7 @@ export function WizardMigrationPage(props: OurPagePropsType) { setProgress(""); try { let malformed = 0; + let badMtime = 0; const etebase = props.etebase!; const colMgr = etebase.getCollectionManager(); @@ -471,14 +472,19 @@ export function WizardMigrationPage(props: OurPagePropsType) { prevUid = entry.uid; const pimItem = parseFunc(syncEntry.content); const uid = pimItem.uid; - // When we can't set mtime, set to the item's position in the change log so we at least maintain EteSync 1.0 ordering. - const mtime = (pimItem.lastModified?.toJSDate())?.getTime() ?? now + done; if (!uid) { malformed++; continue; } + // When we can't set mtime, set to the item's position in the change log so we at least maintain EteSync 1.0 ordering. + let mtime = (pimItem.lastModified?.toJSDate())?.getTime(); + if (!mtime) { + mtime = now + done; + badMtime++; + } + let item = items.get(uid); if (item) { // Existing item @@ -509,10 +515,14 @@ export function WizardMigrationPage(props: OurPagePropsType) { } await etebase.logout(); - if (malformed > 0) { - setProgress(`Done\nIgnored ${malformed} entries (probably safe to ignore)`); - } else { - setProgress("Done"); + { + let out = "Done"; + if (badMtime > 0) { + out += `\nModification time missing for ${badMtime} entries (setting to "now")`; + } else if (malformed > 0) { + out += `\nIgnored ${malformed} entries (probably safe to ignore)`; + } + setProgress(out); } setDone(true);