fix: 锁定按钮改为随时可用,不联动审核状态
- 前端:锁定按钮仅受 IsLocked 控制,移除 status!=pending 的条件 - 后端:Lock 方法移除 pending 状态的阻止,锁定状态独立
This commit is contained in:
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user