aboutsummaryrefslogtreecommitdiff
path: root/syncapi/internal/keychange.go
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2022-08-19 15:32:24 +0200
committerGitHub <noreply@github.com>2022-08-19 15:32:24 +0200
commit9dc57122d991d54ea6750448ba88c8763a569830 (patch)
tree5ca6f93e03fc672eb3182ed69c966cea90e15111 /syncapi/internal/keychange.go
parent56b55a28f591cd2e920c5f16bee6f7a97b0898c0 (diff)
Fetch more data for newly joined rooms in an incremental sync (#2657)
If we've joined a new room in an incremental sync, try fetching more data. This deflakes the complement server notices test (at least in my tests).
Diffstat (limited to 'syncapi/internal/keychange.go')
-rw-r--r--syncapi/internal/keychange.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/syncapi/internal/keychange.go b/syncapi/internal/keychange.go
index 23824e36..c5180e33 100644
--- a/syncapi/internal/keychange.go
+++ b/syncapi/internal/keychange.go
@@ -18,14 +18,16 @@ import (
"context"
"strings"
+ "github.com/matrix-org/gomatrixserverlib"
+ "github.com/matrix-org/util"
+ "github.com/sirupsen/logrus"
+ "github.com/tidwall/gjson"
+
keyapi "github.com/matrix-org/dendrite/keyserver/api"
keytypes "github.com/matrix-org/dendrite/keyserver/types"
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/syncapi/storage"
"github.com/matrix-org/dendrite/syncapi/types"
- "github.com/matrix-org/gomatrixserverlib"
- "github.com/matrix-org/util"
- "github.com/sirupsen/logrus"
)
// DeviceOTKCounts adds one-time key counts to the /sync response
@@ -277,6 +279,10 @@ func membershipEventPresent(events []gomatrixserverlib.ClientEvent, userID strin
// it's enough to know that we have our member event here, don't need to check membership content
// as it's implied by being in the respective section of the sync response.
if ev.Type == gomatrixserverlib.MRoomMember && ev.StateKey != nil && *ev.StateKey == userID {
+ // ignore e.g. join -> join changes
+ if gjson.GetBytes(ev.Unsigned, "prev_content.membership").Str == gjson.GetBytes(ev.Content, "membership").Str {
+ continue
+ }
return true
}
}