aboutsummaryrefslogtreecommitdiff
path: root/syncapi
diff options
context:
space:
mode:
authorS7evinK <2353100+S7evinK@users.noreply.github.com>2022-03-14 20:04:24 +0100
committerGitHub <noreply@github.com>2022-03-14 20:04:24 +0100
commita2cf1aaf4819c1548534accdc90768cc44ed6edd (patch)
tree51688fcea788cc1071bf09c65f6cbae2611c0c1c /syncapi
parent01d71a767dbd11fd7b17b948db6d3052f577c796 (diff)
Fix /context with lazy_load_members (#2277)
* Add membership events to the end of the list, to ensure Sytest sees them * Move tests to allowlist * Append to correct list, fix logging message * Add flakey tests to blacklist * Remove flakey tests from whitelist
Diffstat (limited to 'syncapi')
-rw-r--r--syncapi/routing/context.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/syncapi/routing/context.go b/syncapi/routing/context.go
index d07fc0c6..2412bc2a 100644
--- a/syncapi/routing/context.go
+++ b/syncapi/routing/context.go
@@ -66,7 +66,7 @@ func Context(
membershipRes := roomserver.QueryMembershipForUserResponse{}
membershipReq := roomserver.QueryMembershipForUserRequest{UserID: device.UserID, RoomID: roomID}
if err = rsAPI.QueryMembershipForUser(ctx, &membershipReq, &membershipRes); err != nil {
- logrus.WithError(err).Error("unable to fo membership")
+ logrus.WithError(err).Error("unable to query membership")
return jsonerror.InternalServerError()
}
@@ -158,17 +158,19 @@ func applyLazyLoadMembers(filter *gomatrixserverlib.RoomEventFilter, eventsAfter
}
newState := []*gomatrixserverlib.HeaderedEvent{}
+ membershipEvents := []*gomatrixserverlib.HeaderedEvent{}
for _, event := range state {
if event.Type() != gomatrixserverlib.MRoomMember {
newState = append(newState, event)
} else {
// did the user send an event?
if x[event.Sender()] {
- newState = append(newState, event)
+ membershipEvents = append(membershipEvents, event)
}
}
}
- return newState
+ // Add the membershipEvents to the end of the list, to make Sytest happy
+ return append(newState, membershipEvents...)
}
func parseRoomEventFilter(req *http.Request) (*gomatrixserverlib.RoomEventFilter, error) {