From f5eeb8461a6be6f0b0328a6138c7e35bf7952d42 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 21 Oct 2024 23:11:02 +0300 Subject: [PATCH] hicli/sync: enable reaction count collection for all events The reaction aggregation probably needs to be redone to support finding the entire event (to see senders and other content like shortcodes), but this is good enough to get reactions rendering. --- pkg/hicli/paginate.go | 4 ++++ pkg/hicli/sync.go | 1 + 2 files changed, 5 insertions(+) diff --git a/pkg/hicli/paginate.go b/pkg/hicli/paginate.go index 8d7bf05..f37de3d 100644 --- a/pkg/hicli/paginate.go +++ b/pkg/hicli/paginate.go @@ -220,6 +220,10 @@ func (h *HiClient) PaginateServer(ctx context.Context, roomID id.RoomID, limit i return fmt.Errorf("failed to save session request for %s: %w", entry.SessionID, err) } } + err = h.DB.Event.FillReactionCounts(ctx, roomID, events) + if err != nil { + return fmt.Errorf("failed to fill last edit row IDs: %w", err) + } err = h.DB.Event.FillLastEditRowIDs(ctx, roomID, events) if err != nil { return fmt.Errorf("failed to fill last edit row IDs: %w", err) diff --git a/pkg/hicli/sync.go b/pkg/hicli/sync.go index 7e3a3bd..39130f7 100644 --- a/pkg/hicli/sync.go +++ b/pkg/hicli/sync.go @@ -430,6 +430,7 @@ func (h *HiClient) processEvent( } } dbEvt := database.MautrixToEvent(evt) + dbEvt.Reactions = make(map[string]int) contentWithoutFallback := removeReplyFallback(evt) if contentWithoutFallback != nil { dbEvt.Content = contentWithoutFallback