mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-03-03 17:03:10 -06:00
Add notifications even without existing room in the response
This commit is contained in:
parent
78828edd46
commit
6a992eaa80
|
|
@ -39,16 +39,16 @@ func (p *NotificationDataStreamProvider) IncrementalSync(
|
|||
return from
|
||||
}
|
||||
|
||||
// We're merely decorating existing rooms. Note that the Join map
|
||||
// values are not pointers.
|
||||
for roomID, jr := range req.Response.Rooms.Join {
|
||||
counts := countsByRoom[roomID]
|
||||
if counts == nil {
|
||||
continue
|
||||
// Add notification data to rooms.
|
||||
// Create an empty JoinResponse if the room isn't in this response
|
||||
for roomID, notificationData := range countsByRoom {
|
||||
jr, exists := req.Response.Rooms.Join[roomID]
|
||||
if !exists {
|
||||
jr = *types.NewJoinResponse()
|
||||
}
|
||||
jr.UnreadNotifications = &types.UnreadNotifications{
|
||||
HighlightCount: counts.UnreadHighlightCount,
|
||||
NotificationCount: counts.UnreadNotificationCount,
|
||||
HighlightCount: notificationData.UnreadHighlightCount,
|
||||
NotificationCount: notificationData.UnreadNotificationCount,
|
||||
}
|
||||
req.Response.Rooms.Join[roomID] = jr
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue