From 3fc26339d80a6041a0df4fdca9f41afe0d08c893 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 10 Aug 2023 14:09:26 +0300 Subject: [PATCH] Send notifications if applicable when using beeper batch sending --- backfill.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/backfill.go b/backfill.go index 01bd3b2..f812550 100644 --- a/backfill.go +++ b/backfill.go @@ -239,10 +239,18 @@ func (portal *Portal) backfillSendBatch(ctx context.Context, converted []*Conver dbMessages = append(dbMessages, dbm) } } + forward := true + log.Debug(). + Int("event_count", len(events)). + Bool("forward", forward). + Bool("mark_read", markReadBy != ""). + Bool("notify", markReadBy == ""). + Msg("Sending batch of messages") _, err := portal.MainIntent().BeeperBatchSend(portal.MXID, &mautrix.ReqBeeperBatchSend{ - Forward: true, - MarkReadBy: markReadBy, - Events: events, + Forward: forward, + MarkReadBy: markReadBy, + SendNotification: forward && markReadBy == "", + Events: events, }) if err != nil { log.Err(err).Msg("Failed to send batch of messages")