feat: SSR 评论编辑与作者删除

帖详情提供时限内编辑与软删入口,作者删除与管理员共用回收站子树语义。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-29 21:36:12 +08:00
parent 54f5de07a4
commit 145c7a3e1f
8 changed files with 269 additions and 3 deletions

View File

@@ -116,6 +116,15 @@
{{if not $.CommentsLocked}}
<button type="button" class="j13-linkbtn j13-comment__reply-btn" data-reply-to="{{.ID}}" data-reply-floor="{{.Floor}}" data-reply-author="{{.AuthorName}}">回复</button>
{{end}}
{{if .CanEdit}}
<a class="j13-linkbtn" href="/post/{{$.PostID}}/comments/{{.ID}}/edit">编辑</a>
{{end}}
{{if .CanDelete}}
<form method="post" action="/post/{{$.PostID}}/comments/{{.ID}}/delete" class="j13-inline-form" onsubmit="return confirm('确定删除该评论?回复也会一并移入回收站。');">
<input type="hidden" name="_csrf" value="{{$.CSRF}}"/>
<button type="submit" class="j13-linkbtn">删除</button>
</form>
{{end}}
{{if .CanReport}}
<details class="j13-report">
<summary class="j13-linkbtn">举报</summary>

View File

@@ -0,0 +1,19 @@
{{define "post/comment_edit"}}
{{template "base/head" .}}
{{template "base/navbar" .}}
<main class="j13-main j13-main--solo">
<h1>编辑评论</h1>
<p class="j13-muted">#{{.Floor}} · <a href="/post/{{.PostID}}#floor-{{.Floor}}">返回帖子</a></p>
{{template "base/alert" .}}
<form method="post" action="/post/{{.PostID}}/comments/{{.CommentID}}/edit" class="j13-form j13-comment-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<label for="comment-edit-content">内容</label>
<textarea id="comment-edit-content" name="content" rows="6" required maxlength="8000">{{.Content}}</textarea>
<div class="j13-form__row">
<button type="submit">保存</button>
<a class="j13-btn-secondary" href="/post/{{.PostID}}#floor-{{.Floor}}">取消</a>
</div>
</form>
</main>
{{template "base/footer" .}}
{{end}}