Only create NewJoinResponse if we don't already have one

This commit is contained in:
Till Faelligen 2022-10-02 14:07:12 +02:00
parent d892a88dbe
commit dd3d53bcad
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E
2 changed files with 8 additions and 7 deletions

View file

@ -91,9 +91,9 @@ func (p *AccountDataStreamProvider) IncrementalSync(
}
} else {
if roomData, ok := dataRes.RoomAccountData[roomID][dataType]; ok {
joinData := *types.NewJoinResponse()
if existing, ok := req.Response.Rooms.Join[roomID]; ok {
joinData = existing
joinData, ok := req.Response.Rooms.Join[roomID]
if !ok {
joinData = *types.NewJoinResponse()
}
joinData.AccountData.Events = append(
joinData.AccountData.Events,

View file

@ -4,10 +4,11 @@ import (
"context"
"encoding/json"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/dendrite/internal/caching"
"github.com/matrix-org/dendrite/syncapi/storage"
"github.com/matrix-org/dendrite/syncapi/types"
"github.com/matrix-org/gomatrixserverlib"
)
type TypingStreamProvider struct {
@ -35,9 +36,9 @@ func (p *TypingStreamProvider) IncrementalSync(
continue
}
jr := *types.NewJoinResponse()
if existing, ok := req.Response.Rooms.Join[roomID]; ok {
jr = existing
jr, ok := req.Response.Rooms.Join[roomID]
if !ok {
jr = *types.NewJoinResponse()
}
if users, updated := p.EDUCache.GetTypingUsersIfUpdatedAfter(