Restore tree-structured comments in Blog Details

The $.psc.blogcomment widget (from the removed wwwroot/js/comment.js)
provided reply-to-comment nesting. Rewrite Details.cshtml to drive the
same /api/v1/blogcomments endpoint with ParentId, delegating reply
clicks so they work across the whole nested tree.

Render comment metadata server-side in the Comment view component
template (the widget used to add it client-side) and Include Author so
nested comments get their author instead of relying on the request-scoped
identity map.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Paul Schneider 2026-09-21 11:21:33 +01:00
commit 15c64bbf7b
3 changed files with 233 additions and 87 deletions

View file

@ -18,7 +18,10 @@ namespace Yavsc.ViewComponents
}
public async Task<IViewComponentResult> InvokeAsync(long id)
{
var comment = await context.Comment.Include(c=>c.Children).FirstOrDefaultAsync(c => c.Id==id);
var comment = await context.Comment
.Include(c => c.Children)
.Include(c => c.Author)
.FirstOrDefaultAsync(c => c.Id==id);
if (comment == null)
throw new InvalidOperationException();
ViewBag.apictlr = "/api/v1/blogcomments";