From 304660617f0aaa089e017eb74032de896a03c320 Mon Sep 17 00:00:00 2001 From: Shen Junzheng Date: Thu, 10 Apr 2025 16:23:53 +0800 Subject: [PATCH] fix v4 chatroom display name --- internal/model/chatroom_v4.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/internal/model/chatroom_v4.go b/internal/model/chatroom_v4.go index 673ccec..e202f38 100644 --- a/internal/model/chatroom_v4.go +++ b/internal/model/chatroom_v4.go @@ -20,9 +20,17 @@ func (c *ChatRoomV4) Wrap() *ChatRoom { users = ParseRoomData(c.ExtBuffer) } + user2DisplayName := make(map[string]string, len(users)) + for _, user := range users { + if user.DisplayName != "" { + user2DisplayName[user.UserName] = user.DisplayName + } + } + return &ChatRoom{ - Name: c.UserName, - Owner: c.Owner, - Users: users, + Name: c.UserName, + Owner: c.Owner, + Users: users, + User2DisplayName: user2DisplayName, } }