fix(import): overwrite mode restores favorite and pinned too
F1 passed when the entry had been deleted first (INSERT path) but not in overwrite mode: that path uses PUT, and PUT deliberately ignores favorite/pinned so a SYNC update can never clobber the local flags — they are device-local by design. A restore, however, must bring them back. The overwrite loop now applies them through the dedicated toggle endpoints, and only when they differ from the local entry. JS-only: PUT keeps ignoring them, so sync behaviour is untouched. Splits the F1 scenario into F1a (delete + reimport, already green) and F1b (overwrite). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -728,6 +728,19 @@ async function doImport() {
|
||||
// restore the file's icon separately — else overwriting
|
||||
// an entry whose icon was cleared never brings it back.
|
||||
if (src.icon_b64) await saveEntryIcon(local.id, src.icon_b64, !!src.icon_custom);
|
||||
// favorite / pinned are the same story: PUT deliberately
|
||||
// ignores them so a SYNC update can never clobber the local
|
||||
// flags (they're device-local by design). But a restore
|
||||
// must bring them back, so apply them here through their
|
||||
// own toggle endpoints — only when they actually differ.
|
||||
if (!!src.favorite !== !!local.favorite) {
|
||||
await api('/entries/' + local.id + '/favorite',
|
||||
{ method: 'POST', headers: authHeaders() });
|
||||
}
|
||||
if (!!src.pinned !== !!local.pinned) {
|
||||
await api('/entries/' + local.id + '/pin',
|
||||
{ method: 'POST', headers: authHeaders() });
|
||||
}
|
||||
overwritten++;
|
||||
} catch (_) { /* skip the single row on failure */ }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user