- Defensively parse parent_id in _render_htmx_error: coerce to int,
fallback to main form if non-numeric or parent not found
- Rebuild Tailwind CSS to include new utility classes from templates
- Add test for tampered parent_id falling back to main form
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Review blocker A — form error swap and false success:
- Change HTMX contract so forms target their own container (outerHTML)
instead of appending to #comments-list
- Use OOB swaps to append approved comments to the correct target
- Add success/error message display inside form templates
- Remove hx-on::after-request handlers (no longer needed)
Review blocker B — reply rendering shape:
- Create _reply.html partial with compact reply markup
- Approved replies via HTMX now use compact template + OOB swap
into parent's .replies-container
- Reply form errors render inside reply form container
E2E test fixes:
- Update 4 failing tests to wait for inline HTMX messages instead
of redirect-based URL assertions
- Add aria-label='Comment form errors' to form error display
- Rename test_reply_submission_redirects to
test_reply_submission_shows_moderation_message
Mypy internal error workaround:
- Add mypy override for apps.comments.views (django-stubs triggers
internal error on ORM annotate() chain with mypy 1.11.2)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1. Reply HTMX target: server sends HX-Retarget/HX-Reswap headers to
insert replies inside parent comment's .replies-container div
2. Empty thread swap target: always render #comments-list container
even when no approved comments exist
3. Reaction hydration: add _annotate_reaction_counts() helper that
hydrates reaction_counts and user_reacted on comments in
get_context(), comment_poll(), and single-comment responses
4. HTMX error swap: return 200 instead of 422 for form errors since
HTMX 2 doesn't swap 4xx responses by default
5. Vary header: use patch_vary_headers() instead of direct assignment
to avoid overwriting existing Vary directives
Also fixes _get_session_key() to handle missing session attribute
(e.g. from RequestFactory in performance tests).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>