fix: 已锁定文章禁止提交审核,隐藏提交按钮

- SubmitForAudit 新增 IsLocked 检查,锁定文章不可提交审核
- posts/show.html:已锁定文章不显示"提交审核"按钮
This commit is contained in:
2026-05-31 20:13:34 +08:00
parent 968e8af8a3
commit 0cfbb6911d
2 changed files with 4 additions and 1 deletions

View File

@ -251,6 +251,9 @@ func (s *PostService) SubmitForAudit(postID uint) error {
if err != nil {
return err
}
if post.IsLocked {
return common.ErrPostCannotEdit
}
if post.Status != model.PostStatusDraft && post.Status != model.PostStatusRejected {
return common.ErrPostCannotSubmit
}

View File

@ -36,7 +36,7 @@
{{if and $.Post (or (eq $.Post.UserID $.UID) $.CanAccessAdmin) (ne $.Post.Status "pending") (not $.Post.IsLocked)}}
<a href="/studio/write?id={{$.Post.ID}}" class="btn btn-secondary">编辑</a>
{{end}}
{{if and $.Post (eq $.Post.UserID $.UID) (or (eq $.Post.Status "draft") (eq $.Post.Status "rejected"))}}
{{if and $.Post (eq $.Post.UserID $.UID) (or (eq $.Post.Status "draft") (eq $.Post.Status "rejected")) (not $.Post.IsLocked)}}
<button class="btn btn-primary" id="submitAuditBtn" data-id="{{$.Post.ID}}">提交审核</button>
{{end}}
</div>