fix(journals): resolve decryption toggle issues and component errors

- Added diagnostic logging to decryption helper to track passcode source.
- Refactored 'handle_content_decryption' to prioritize unlocking content.
- Fixed 'updated_obj' reference error in main view.
This commit is contained in:
Scott Idem
2026-01-14 16:00:05 -05:00
parent 6562d4ba04
commit 05bf348e0f
2 changed files with 22 additions and 5 deletions

View File

@@ -226,15 +226,24 @@
}
async function handle_content_decryption() {
if (!tmp_entry_obj.content) {
const journal = $lq__journal_obj;
const entry = $lq__journal_entry_obj;
if (!journal?.id || !entry) return;
// If encrypted and not currently decrypted, run the decryption workflow
if (entry.content_encrypted && !tmp_entry_obj.content) {
await run_decryption_workflow();
} else {
// Re-lock logic
// Toggle logic: if already decrypted, "lock" it by clearing local state
is_processing = true;
tmp_entry_obj.content = null;
if (orig_entry_obj) orig_entry_obj.content = null;
tmp_entry_obj.history = null;
if (orig_entry_obj) {
orig_entry_obj.content = null;
orig_entry_obj.history = null;
}
journals_sess.update(s => {
s.journal_kv[$lq__journal_obj.id].journal_passcode_decrypted = false;
s.journal_kv[journal.id].journal_passcode_decrypted = false;
return s;
});
is_processing = false;
@@ -322,7 +331,7 @@
journal_config={$lq__journal_obj?.cfg_json}
mode={modal_mode}
onClose={() => (show_append_modal = false)}
onUpdate={() => { show_append_modal = false; updated_obj = true; }}
onUpdate={() => { show_append_modal = false; }}
{log_lvl}
/>
{:else}