aboutsummaryrefslogtreecommitdiff
path: root/syncapi/streams
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-04-27 12:03:34 +0100
committerGitHub <noreply@github.com>2022-04-27 12:03:34 +0100
commitdca4afd2f0871ed53109121dff17048e69cc4935 (patch)
tree2a911fdbddc2652b282fe45d622f8dc764b863d4 /syncapi/streams
parent66b397b3c60c51bba36e4bce858733b2fda26f6a (diff)
Don't send account data or receipts for left/forgotten rooms (#2382)
* Only include account data and receipts for rooms in a complete sync that we care about * Fix global account data
Diffstat (limited to 'syncapi/streams')
-rw-r--r--syncapi/streams/stream_accountdata.go6
-rw-r--r--syncapi/streams/stream_receipt.go6
2 files changed, 12 insertions, 0 deletions
diff --git a/syncapi/streams/stream_accountdata.go b/syncapi/streams/stream_accountdata.go
index 99cd4a92..2cddbcf0 100644
--- a/syncapi/streams/stream_accountdata.go
+++ b/syncapi/streams/stream_accountdata.go
@@ -53,6 +53,12 @@ func (p *AccountDataStreamProvider) IncrementalSync(
// Iterate over the rooms
for roomID, dataTypes := range dataTypes {
+ // For a complete sync, make sure we're only including this room if
+ // that room was present in the joined rooms.
+ if from == 0 && roomID != "" && !req.IsRoomPresent(roomID) {
+ continue
+ }
+
// Request the missing data from the database
for _, dataType := range dataTypes {
dataReq := userapi.QueryAccountDataRequest{
diff --git a/syncapi/streams/stream_receipt.go b/syncapi/streams/stream_receipt.go
index 9d7d479a..f4e84c7d 100644
--- a/syncapi/streams/stream_receipt.go
+++ b/syncapi/streams/stream_receipt.go
@@ -62,6 +62,12 @@ func (p *ReceiptStreamProvider) IncrementalSync(
}
for roomID, receipts := range receiptsByRoom {
+ // For a complete sync, make sure we're only including this room if
+ // that room was present in the joined rooms.
+ if from == 0 && !req.IsRoomPresent(roomID) {
+ continue
+ }
+
jr := *types.NewJoinResponse()
if existing, ok := req.Response.Rooms.Join[roomID]; ok {
jr = existing