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:
@ -14,6 +14,7 @@ type Post struct {
|
||||
Excerpt string `gorm:"type:varchar(500)" json:"excerpt"` // plain text summary for list
|
||||
UserID uint `gorm:"index;not null" json:"user_id"`
|
||||
Status string `gorm:"type:varchar(20);index;default:draft;not null" json:"status"`
|
||||
IsLocked bool `gorm:"default:false" json:"is_locked"`
|
||||
RejectReason string `gorm:"type:varchar(500);default:''" json:"reject_reason,omitempty"`
|
||||
AllowComment bool `gorm:"default:true" json:"allow_comment"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
|
||||
Reference in New Issue
Block a user