fix: 锁定按钮改为随时可用,不联动审核状态

- 前端:锁定按钮仅受 IsLocked 控制,移除 status!=pending 的条件
- 后端:Lock 方法移除 pending 状态的阻止,锁定状态独立
This commit is contained in:
2026-06-02 22:31:34 +08:00
parent ca21ae7216
commit a806532d25
2 changed files with 2 additions and 5 deletions

View File

@ -155,15 +155,12 @@ func (s *PostService) Reject(postID uint, reason string) error {
}
// Lock 锁定:设置 IsLocked 标志,禁止编辑,不改变帖子发布状态
// 锁定状态独立于审核状态,任何状态的帖子均可锁定
func (s *PostService) Lock(postID uint, reason string) error {
post, err := s.findPost(postID)
if err != nil {
return err
}
// 待审核帖子不允许锁定(审核流程中)
if post.Status == model.PostStatusPending {
return common.ErrPostCannotLock
}
post.IsLocked = true
post.LockReason = reason
return s.repo.Update(post)

View File

@ -57,7 +57,7 @@
<button class="btn btn-sm btn-success post-approve" data-id="{{.ID}}">通过修订</button>
<button class="btn btn-sm btn-warning post-reject" data-id="{{.ID}}">退回修订</button>
{{end}}
{{if and (not .IsLocked) (ne .Status "pending")}}
{{if not .IsLocked}}
<button class="btn btn-sm btn-danger post-lock" data-id="{{.ID}}">锁定</button>
{{end}}
{{if .IsLocked}}