mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-22 18:45:19 +02:00
make email tab backwards compatible
This commit is contained in:
parent
9ee42d2f75
commit
55490fa63c
1 changed files with 10 additions and 0 deletions
|
|
@ -1031,9 +1031,19 @@ async function performSync() {
|
||||||
console.log("Authorization successful. Starting sync...");
|
console.log("Authorization successful. Starting sync...");
|
||||||
|
|
||||||
const state = loadState(STATE_FILE);
|
const state = loadState(STATE_FILE);
|
||||||
|
// Backfill case: users who upgraded from a pre-inbox-view build have a
|
||||||
|
// stored historyId but no inbox_lists/ cache, so partialSync would only
|
||||||
|
// touch *new* threads and the inbox UI would stay empty. Force a one-
|
||||||
|
// shot fullSync to populate snapshots for the lookback window. After
|
||||||
|
// this runs once, the cache directory is populated and we fall back to
|
||||||
|
// partial-sync on subsequent calls.
|
||||||
|
const cacheMissing = !fs.existsSync(CACHE_DIR) || fs.readdirSync(CACHE_DIR).length === 0;
|
||||||
if (!state.historyId) {
|
if (!state.historyId) {
|
||||||
console.log("No history ID found, starting full sync...");
|
console.log("No history ID found, starting full sync...");
|
||||||
await fullSync(auth, SYNC_DIR, ATTACHMENTS_DIR, STATE_FILE, LOOKBACK_DAYS);
|
await fullSync(auth, SYNC_DIR, ATTACHMENTS_DIR, STATE_FILE, LOOKBACK_DAYS);
|
||||||
|
} else if (cacheMissing) {
|
||||||
|
console.log("History ID present but inbox cache empty — running full sync to backfill snapshots...");
|
||||||
|
await fullSync(auth, SYNC_DIR, ATTACHMENTS_DIR, STATE_FILE, LOOKBACK_DAYS);
|
||||||
} else {
|
} else {
|
||||||
console.log("History ID found, starting partial sync...");
|
console.log("History ID found, starting partial sync...");
|
||||||
await partialSync(auth, state.historyId, SYNC_DIR, ATTACHMENTS_DIR, STATE_FILE, LOOKBACK_DAYS);
|
await partialSync(auth, state.historyId, SYNC_DIR, ATTACHMENTS_DIR, STATE_FILE, LOOKBACK_DAYS);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue