fix: help page back link preserves active persona
Pass ?persona= query param on the help link so the server knows which persona to return to. Previously always defaulted to personas[0], causing navigation back to the wrong persona. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,13 +32,17 @@ def _get_session_user(request: Request) -> str | None:
|
||||
|
||||
|
||||
@router.get("/help", include_in_schema=False)
|
||||
async def help_page(request: Request):
|
||||
async def help_page(request: Request, persona: str = ""):
|
||||
username = _get_session_user(request)
|
||||
if not username:
|
||||
return RedirectResponse("/login", status_code=302)
|
||||
|
||||
personas = list_user_personas(username)
|
||||
back_persona = personas[0] if personas else ""
|
||||
# Use persona from query param if valid, else fall back to first
|
||||
if persona and persona in personas:
|
||||
back_persona = persona
|
||||
else:
|
||||
back_persona = personas[0] if personas else ""
|
||||
back_href = f"/{username}/{back_persona}" if back_persona else "/"
|
||||
|
||||
html = (_STATIC / "help.html").read_text()
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
|
||||
if (headerEmoji) headerEmoji.textContent = CORTEX_EMOJI;
|
||||
|
||||
// Wire help link to preserve current persona on return
|
||||
const helpLink = document.getElementById('help-link');
|
||||
if (helpLink) helpLink.href = `/help?persona=${encodeURIComponent(CORTEX_PERSONA)}`;
|
||||
|
||||
let sessionId = null;
|
||||
let primaryBackend = 'claude';
|
||||
let activeController = null;
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<a href="/help" class="hdr-btn" title="Help & reference" style="text-decoration:none">
|
||||
<a id="help-link" href="/help" class="hdr-btn" title="Help & reference" style="text-decoration:none">
|
||||
<svg data-lucide="circle-help" class="btn-icon"></svg>
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
Reference in New Issue
Block a user