Skip to content

fix(engine): wire notes into post and page rendering (#59)#72

Merged
x3ek merged 2 commits intomainfrom
fix/59-notes-not-displayed
Mar 21, 2026
Merged

fix(engine): wire notes into post and page rendering (#59)#72
x3ek merged 2 commits intomainfrom
fix/59-notes-not-displayed

Conversation

@x3ek
Copy link
Contributor

@x3ek x3ek commented Mar 21, 2026

Summary

  • Fetch notes from NotesService.get_for_path() in post and page routers instead of hardcoding []
  • Public notes visible to all users, private notes only to authenticated admins
  • Extract shared is_admin helper from posts.py to dependencies.py to avoid duplication
  • Update existing tests to mock the new NotesService dependency

Closes #59

Test plan

  • python scripts/run-checks.py — 4/4 checks pass (format, lint, 137 tests, pyright)
  • Manual: public note renders on post page (default theme)
  • Manual: public note renders on static page (default theme)
  • Manual: private note visible in admin mode, hidden for non-admin visitors
  • Manual: notes render correctly in blue-tech theme
  • Manual: notes render correctly in terminal theme

🤖 Generated with Claude Code

x3ek and others added 2 commits March 21, 2026 08:32
Fetch notes from NotesService in post and page routers instead of hardcoding empty list. Public notes visible to all users, private notes only to admins. Extract shared is_admin helper to dependencies.py.

Closes #59

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Test correct path format, admin vs anonymous visibility, notes passed to templates, and empty notes rendering for both post and page routers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link

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

Wires database-backed notes into post and static page rendering so templates receive the correct notes list, with private notes gated to admins.

Changes:

  • Fetch notes via NotesService.get_for_path() in get_post and get_page instead of hardcoding [].
  • Add DB session injection to post/page render routes to support notes queries.
  • Extract is_admin helper to dependencies.py and update tests to match.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/squishmark/routers/posts.py Injects DB session and fetches notes for /posts/{slug} during post rendering.
src/squishmark/routers/pages.py Injects DB session and fetches notes for /{slug} during page rendering.
src/squishmark/dependencies.py Introduces shared is_admin(request) helper.
tests/test_posts.py Updates admin-detection tests to import/patch the moved is_admin.
tests/test_notes_rendering.py Adds coverage asserting notes are fetched and passed to theme rendering for posts/pages.
tests/test_nav_pages.py Updates router tests to account for new DB/notes dependencies.

@x3ek x3ek merged commit cc56043 into main Mar 21, 2026
9 checks passed
@x3ek x3ek deleted the fix/59-notes-not-displayed branch March 21, 2026 13:55
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.

Notes not displayed on post and page renders

2 participants