fix: the assistant page finishes loading for non-admin accounts

The download-transcript button is removed for anyone who is not an admin,
but the event binder still called addEventListener on it unguarded. The
throw stopped the binder before the saved-chat list loaded, before the
click handler for opening old chats was registered, and before the send
box was fully wired, so a non-admin saw no chats until New chat, could not
open old ones, and could not chat. The button is now bound only if present.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016fZGJNyDvERbMgS2Uc2msP
This commit is contained in:
Daniel 2026-09-15 19:59:29 +02:00
parent 3c04d662f6
commit ac3e6bf3f0

View file

@ -364,7 +364,9 @@ import {
if (layout) layout.classList.remove('mobile-chats-open'); // back to the chat if (layout) layout.classList.remove('mobile-chats-open'); // back to the chat
clearConversation(ev); clearConversation(ev);
}); });
document.getElementById('btn-assistant-download-chat').addEventListener('click', downloadTranscript); // Removed before this runs for anyone who is not an admin, so it may be gone.
var downloadChatBtn = document.getElementById('btn-assistant-download-chat');
if (downloadChatBtn) downloadChatBtn.addEventListener('click', downloadTranscript);
if (input) { if (input) {
input.addEventListener('input', updateConversationBudget); input.addEventListener('input', updateConversationBudget);
input.addEventListener('input', resizeAssistantInput); input.addEventListener('input', resizeAssistantInput);