Set the notification count when sending push notifications (#2683)

This commit is contained in:
Till 2022-08-30 14:54:57 +02:00 committed by GitHub
parent 7313f56f44
commit 93a6e2f4d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,10 @@ import (
"strings" "strings"
"time" "time"
"github.com/matrix-org/gomatrixserverlib"
"github.com/nats-io/nats.go"
log "github.com/sirupsen/logrus"
"github.com/matrix-org/dendrite/internal/eventutil" "github.com/matrix-org/dendrite/internal/eventutil"
"github.com/matrix-org/dendrite/internal/pushgateway" "github.com/matrix-org/dendrite/internal/pushgateway"
"github.com/matrix-org/dendrite/internal/pushrules" "github.com/matrix-org/dendrite/internal/pushrules"
@ -20,9 +24,6 @@ import (
"github.com/matrix-org/dendrite/userapi/storage" "github.com/matrix-org/dendrite/userapi/storage"
"github.com/matrix-org/dendrite/userapi/storage/tables" "github.com/matrix-org/dendrite/userapi/storage/tables"
"github.com/matrix-org/dendrite/userapi/util" "github.com/matrix-org/dendrite/userapi/util"
"github.com/matrix-org/gomatrixserverlib"
"github.com/nats-io/nats.go"
log "github.com/sirupsen/logrus"
) )
type OutputStreamEventConsumer struct { type OutputStreamEventConsumer struct {
@ -529,7 +530,9 @@ func (s *OutputStreamEventConsumer) notifyHTTP(ctx context.Context, event *gomat
case "event_id_only": case "event_id_only":
req = pushgateway.NotifyRequest{ req = pushgateway.NotifyRequest{
Notification: pushgateway.Notification{ Notification: pushgateway.Notification{
Counts: &pushgateway.Counts{}, Counts: &pushgateway.Counts{
Unread: userNumUnreadNotifs,
},
Devices: devices, Devices: devices,
EventID: event.EventID(), EventID: event.EventID(),
RoomID: event.RoomID(), RoomID: event.RoomID(),