4 Commits

Author SHA1 Message Date
Mark
96b49bb064 ci: retrigger deploy after fixing PROD_SSH_KEY secret
All checks were successful
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / pr-e2e (pull_request) Successful in 1m33s
CI / ci (pull_request) Successful in 1m37s
2026-03-04 11:11:29 +00:00
3ccb872cc3 Merge pull request 'feat: redesign comments section for better UX/UI' (#45) from feature/comments-design-makeover into main
Some checks failed
CI / ci (push) Has been skipped
CI / pr-e2e (push) Has been skipped
CI / nightly-e2e (push) Has been skipped
CI / deploy (push) Failing after 32s
Reviewed-on: #45
Reviewed-by: codex_a <codex_a@linteldigital.com>
2026-03-04 11:00:55 +00:00
Mark
b2ea693d9d fix: resolve review blockers for comments redesign
All checks were successful
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / pr-e2e (pull_request) Successful in 1m36s
CI / ci (pull_request) Successful in 1m38s
- Fix context key mismatch in _render_htmx_success ('reply' vs 'comment')
- Update OOB swap selector to match new sibling relationship for replies container
- Update HTMX reply tests to verify correct OOB selector and content rendering
- Fix variable naming in _reply.html to match parent context
2026-03-04 10:54:25 +00:00
Mark
48f395866b chore: rebuild Tailwind CSS for comments redesign
All checks were successful
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / pr-e2e (pull_request) Successful in 1m35s
CI / ci (pull_request) Successful in 1m37s
2026-03-04 10:31:04 +00:00
3 changed files with 13 additions and 8 deletions

View File

@@ -132,12 +132,13 @@ def test_htmx_reply_returns_oob_reply_when_approved(client, _article, approved_c
)
content = resp.content.decode()
assert resp.status_code == 200
# OOB targets the parent's replies-container
assert f"#comment-{approved_comment.id}" in content
assert "hx-swap-oob" in content
# Reply uses compact markup (no nested reply form)
assert "Reply posted!" in content
# OOB targets the sibling .replies-container of the parent comment article
assert f'hx-swap-oob="beforeend:#comment-{approved_comment.id} ~ .replies-container"' in content
# Verify content is rendered (not empty due to context mismatch)
assert "Replier" in content
assert "Nice reply" in content
reply = Comment.objects.exclude(pk=approved_comment.pk).get()
assert f"comment-{reply.id}" in content
assert reply.parent_id == approved_comment.id
assert reply.is_approved is True

View File

@@ -148,10 +148,14 @@ class CommentCreateView(View):
if comment.is_approved:
ctx = _comment_template_context(comment, article, request)
if comment.parent_id:
comment_html = render_to_string("comments/_reply.html", ctx, request)
# _reply.html expects 'reply' context key
reply_ctx = ctx.copy()
reply_ctx["reply"] = reply_ctx.pop("comment")
comment_html = render_to_string("comments/_reply.html", reply_ctx, request)
# .replies-container is now a sibling of #comment-{id}
oob_html = (
f'<div hx-swap-oob="beforeend:#comment-{comment.parent_id} '
f'.replies-container">{comment_html}</div>'
f'~ .replies-container">{comment_html}</div>'
)
else:
comment_html = render_to_string("comments/_comment.html", ctx, request)

File diff suppressed because one or more lines are too long