fix: 锁定机制不再改变帖子状态,锁定与退回独立
- Post 模型新增 IsLocked 字段,与 Status 解耦 - Lock 仅设 IsLocked=true(不改 Status),已通过帖子锁定后仍公开可见 - Unlock 仅设 IsLocked=false(不改 Status) - Update/EditPage 编辑检查改用 IsLocked 而非 Status==locked - Reject 与 Lock 独立,可单独退回或锁定+退回组合使用 - 新增 ErrPostCannotLock 错误哨兵 - 前端模板编辑按钮/锁定标识基于 IsLocked 渲染
This commit is contained in:
@ -139,7 +139,7 @@ func (ctrl *PostController) EditPage(c *gin.Context) {
|
||||
}
|
||||
|
||||
post, err := ctrl.postService.GetByID(uint(id))
|
||||
if err != nil || post.Status == model.PostStatusPending || post.Status == model.PostStatusLocked {
|
||||
if err != nil || post.Status == model.PostStatusPending || post.IsLocked {
|
||||
c.HTML(http.StatusNotFound, "posts/404.html", common.BuildPageData(c, gin.H{
|
||||
"Title": "未找到或无法编辑",
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user