🐛 Fix broadcast typing status to wrong user

This commit is contained in:
LittleSheep 2024-08-23 23:00:49 +08:00
parent 57444f58f4
commit ea94fd7b54

View File

@ -53,13 +53,14 @@ func SetTypingStatus(channelId uint, userId uint) error {
var channel models.Channel var channel models.Channel
if err := database.C. if err := database.C.
Preload("Members"). Preload("Members").
Preload("Members.Account").
Where("id = ?", channelId). Where("id = ?", channelId).
First(&channel).Error; err != nil { First(&channel).Error; err != nil {
return fmt.Errorf("channel not found: %v", err) return fmt.Errorf("channel not found: %v", err)
} }
for _, item := range channel.Members { for _, item := range channel.Members {
broadcastTarget = append(broadcastTarget, uint64(item.AccountID)) broadcastTarget = append(broadcastTarget, uint64(item.Account.ExternalID))
} }
data = map[string]any{ data = map[string]any{