mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
hicli/database: fix FillReactionCounts
This commit is contained in:
parent
728db4d650
commit
9d96ed1b12
1 changed files with 6 additions and 3 deletions
|
@ -156,14 +156,17 @@ func (eq *EventQuery) UpdateEncryptedContent(ctx context.Context, evt *Event) er
|
|||
}
|
||||
|
||||
func (eq *EventQuery) FillReactionCounts(ctx context.Context, roomID id.RoomID, events []*Event) error {
|
||||
eventIDs := make([]id.EventID, 0)
|
||||
eventIDs := make([]id.EventID, 0, len(events))
|
||||
eventMap := make(map[id.EventID]*Event)
|
||||
for i, evt := range events {
|
||||
for _, evt := range events {
|
||||
if evt.Reactions == nil {
|
||||
eventIDs[i] = evt.ID
|
||||
eventIDs = append(eventIDs, evt.ID)
|
||||
eventMap[evt.ID] = evt
|
||||
}
|
||||
}
|
||||
if len(eventIDs) == 0 {
|
||||
return nil
|
||||
}
|
||||
result, err := eq.GetReactions(ctx, roomID, eventIDs...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Reference in a new issue