Skip to content

fix(docs): populate docs nav entries on login page#171

Merged
appleboy merged 1 commit intomainfrom
worktree-docs
Apr 23, 2026
Merged

fix(docs): populate docs nav entries on login page#171
appleboy merged 1 commit intomainfrom
worktree-docs

Conversation

@appleboy
Copy link
Copy Markdown
Member

Summary

  • Fixes the navbar Docs dropdown being empty for unauthenticated visitors on /login. After 4dbe23d the dropdown is driven by NavbarProps.DocsNavEntries, but LoginPageProps was constructed directly (bypassing buildNavbarProps), so the field stayed at its zero value.
  • Populates DocsNavEntries via NavbarDocsEntriesFor(resolveLocale(c)) at all three LoginPageProps construction sites (initial render, invalid-credentials re-render, session-save failure re-render), so the dropdown also honors docs_lang / Accept-Language.

Test plan

  • make generate && make build succeeds
  • make fmt && make lint clean
  • go test ./internal/handlers/... passes
  • Open /login while logged out → navbar Docs dropdown lists all 8 entries
  • Set cookie docs_lang=zh-TW, reload /login → dropdown shows Traditional Chinese titles
  • Submit bad credentials → error-state login page dropdown is still populated
  • Sanity-check logged-in pages (/account/sessions) still render the dropdown correctly

🤖 Generated with Claude Code

- Pass DocsNavEntries into LoginPageProps so the navbar Docs dropdown renders on the public login page
- Use NavbarDocsEntriesFor with the resolved locale so the dropdown respects the docs_lang cookie and Accept-Language header
- Covers the initial login render and both error re-renders (invalid credentials, session save failure)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 23, 2026 03:18
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/handlers/auth.go 0.00% 12 Missing ⚠️

📢 Thoughts on this report? Let us know!

@appleboy appleboy merged commit 6ca46d6 into main Apr 23, 2026
19 of 20 checks passed
@appleboy appleboy deleted the worktree-docs branch April 23, 2026 03:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the unauthenticated /login navbar “Docs” dropdown being empty by ensuring templates.LoginPageProps includes localized NavbarProps.DocsNavEntries, consistent with other pages that use buildNavbarProps.

Changes:

  • Populate templates.LoginPageProps.NavbarProps.DocsNavEntries during the initial /login render.
  • Populate DocsNavEntries for the invalid-credentials re-render.
  • Populate DocsNavEntries for the session-save-failure re-render (so the dropdown remains populated even on error paths), using resolveLocale(c).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/handlers/auth.go
Comment on lines 101 to +105
templates.RenderTempl(c, http.StatusOK, templates.LoginPage(templates.LoginPageProps{
BaseProps: templates.BaseProps{CSRFToken: middleware.GetCSRFToken(c)},
BaseProps: templates.BaseProps{CSRFToken: middleware.GetCSRFToken(c)},
NavbarProps: templates.NavbarProps{
DocsNavEntries: NavbarDocsEntriesFor(resolveLocale(c)),
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants