feat: @提及支持改名后链接跟随UID + 显示名自动更新

- comment_mentions新增original_username列,创建时记录原始@用户名
- Mentions map改为{original_username: {uid, name}}结构,name为当前显示名
- 用户改名后:旧@文本仍能匹配original_username,链接跟随uid不变,显示名自动更新
- 前端renderMentions适配新结构
This commit is contained in:
2026-06-03 01:00:44 +08:00
parent be8ce04334
commit ae15025b1d
4 changed files with 37 additions and 25 deletions

View File

@ -222,8 +222,9 @@ func (s *CommentService) parseMentions(commentID uint, body string) {
rows, _ := s.repo.SearchUsersByLevel(username, 2, 1)
if len(rows) > 0 {
_ = s.repo.CreateMention(&model.CommentMention{
CommentID: commentID,
UID: rows[0].UID,
CommentID: commentID,
UID: rows[0].UID,
OriginalUsername: username,
})
}
}