mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-11 08:03:09 -06:00
Add join response if we're actually joined to the room
This commit is contained in:
parent
b66cf465e5
commit
44002e033f
|
|
@ -3,6 +3,8 @@ package streams
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
||||
"github.com/matrix-org/dendrite/syncapi/types"
|
||||
)
|
||||
|
||||
|
|
@ -39,12 +41,17 @@ func (p *NotificationDataStreamProvider) IncrementalSync(
|
|||
return from
|
||||
}
|
||||
|
||||
// We're merely decorating existing rooms.
|
||||
for roomID, jr := range req.Response.Rooms.Join {
|
||||
counts := countsByRoom[roomID]
|
||||
if counts == nil {
|
||||
// Add notification data based on the membership of the user
|
||||
for roomID, counts := range countsByRoom {
|
||||
if req.Rooms[roomID] != gomatrixserverlib.Join {
|
||||
continue
|
||||
}
|
||||
// If there's no join response, add a new one
|
||||
jr, ok := req.Response.Rooms.Join[roomID]
|
||||
if !ok {
|
||||
jr = *types.NewJoinResponse()
|
||||
}
|
||||
|
||||
jr.UnreadNotifications = &types.UnreadNotifications{
|
||||
HighlightCount: counts.UnreadHighlightCount,
|
||||
NotificationCount: counts.UnreadNotificationCount,
|
||||
|
|
|
|||
Loading…
Reference in a new issue