mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-16 09:45:24 -04:00
After an AI-written document is closed, its session_id is nulled (the detach behaviour from #1238). Both Open controls in the Documents library — the card's expanded Open button and the card dropdown's Open item — gated on `doc.session_id`: they wired `libraryOpenInSession` (which early-returns with no session) and DISABLED the control otherwise, so the user's own document showed a grayed-out Open button and couldn't be reopened. The module already has `libraryOpenDocument`, which explicitly handles the orphaned case ("just open in editor without switching session" -> _loadDocument by id). Route the no-session path there instead of disabling. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -652,9 +652,10 @@ let _libraryArchivedView = false; // Documents tab showing archived docs?
|
||||
if (doc.session_id) {
|
||||
openItem.addEventListener('click', (e) => { e.stopPropagation(); hideCardDropdown(); libraryOpenInSession(doc); });
|
||||
} else {
|
||||
openItem.disabled = true;
|
||||
openItem.style.opacity = '0.35';
|
||||
openItem.title = 'Not linked to a session';
|
||||
// Orphaned doc (closed / session detached) is still openable in the editor
|
||||
// by id — libraryOpenDocument handles the no-session case (#1602).
|
||||
openItem.title = 'Open in the editor';
|
||||
openItem.addEventListener('click', (e) => { e.stopPropagation(); hideCardDropdown(); libraryOpenDocument(doc); });
|
||||
}
|
||||
dropdown.appendChild(openItem);
|
||||
|
||||
@@ -772,10 +773,10 @@ let _libraryArchivedView = false; // Documents tab showing archived docs?
|
||||
openBtn.title = 'Open in original session';
|
||||
openBtn.addEventListener('click', (e) => { e.stopPropagation(); libraryOpenInSession(doc); });
|
||||
} else {
|
||||
openBtn.disabled = true;
|
||||
openBtn.style.opacity = '0.35';
|
||||
openBtn.style.cursor = 'not-allowed';
|
||||
openBtn.title = 'This document is not linked to a session';
|
||||
// Orphaned doc (closed / session detached) is still openable in the editor
|
||||
// by id — libraryOpenDocument handles the no-session case (#1602).
|
||||
openBtn.title = 'Open in the editor';
|
||||
openBtn.addEventListener('click', (e) => { e.stopPropagation(); libraryOpenDocument(doc); });
|
||||
}
|
||||
|
||||
const cloneBtn = document.createElement('button');
|
||||
|
||||
Reference in New Issue
Block a user