feat: 评论/帖子编辑历史与编辑标记,内容锁定
- 新增 smartDiff 差异计算与 EditHistoryModal 编辑历史弹窗,替换原 CommentEditHistoryModal - 新增 PostEditedMark 编辑标记展示 - 新增内容锁定机制(content_lock)防止并发编辑冲突 - 审核与通知服务适配
This commit is contained in:
@@ -100,6 +100,31 @@ func (s *NotificationService) Create(userID, actorID uint, notifType string, pos
|
||||
}
|
||||
}
|
||||
|
||||
// CreateSystem 系统通知(ActorID=0,提醒对象即本人,绕过自我通知检查;失败静默)
|
||||
func (s *NotificationService) CreateSystem(userID uint, notifType string, postID, commentID uint, content string) {
|
||||
if userID == 0 {
|
||||
return
|
||||
}
|
||||
if len(content) > 200 {
|
||||
content = content[:200]
|
||||
}
|
||||
n := &model.Notification{
|
||||
UserID: userID,
|
||||
ActorID: 0,
|
||||
Type: notifType,
|
||||
PostID: postID,
|
||||
CommentID: commentID,
|
||||
Content: content,
|
||||
IsRead: false,
|
||||
}
|
||||
if err := s.db.Create(n).Error; err != nil {
|
||||
return
|
||||
}
|
||||
if s.OnNotifyNew != nil {
|
||||
s.OnNotifyNew(userID)
|
||||
}
|
||||
}
|
||||
|
||||
// CreateMention 创建群聊 @ 提醒(PostID=0,用 RoomID/MessageID 关联)。
|
||||
// 返回创建出的通知 ID(0 表示未创建),供 handler 实时推送。
|
||||
func (s *NotificationService) CreateMention(userID, actorID, roomID, messageID uint, content string) uint {
|
||||
|
||||
Reference in New Issue
Block a user