aboutsummaryrefslogtreecommitdiff
path: root/roomserver/internal/query
diff options
context:
space:
mode:
authordevonh <devon.dmytro@gmail.com>2023-05-08 19:25:44 +0000
committerGitHub <noreply@github.com>2023-05-08 19:25:44 +0000
commita49c9f01e227aeb12aa2f27d5bf1915453c23a3b (patch)
treee8de0a2dcb4f5f57094dd9024cc6b94793a080ae /roomserver/internal/query
parent2b34f88fde6b3aa633c8f23ff424a5db4951efd3 (diff)
Only require room version instead of room info for db.Events() (#3079)
This reduces the API requirements for the Events database to align with what is actually required.
Diffstat (limited to 'roomserver/internal/query')
-rw-r--r--roomserver/internal/query/query.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/roomserver/internal/query/query.go b/roomserver/internal/query/query.go
index c74bf21b..27c0dd0c 100644
--- a/roomserver/internal/query/query.go
+++ b/roomserver/internal/query/query.go
@@ -212,7 +212,7 @@ func (r *Queryer) QueryMembershipForUser(
response.IsInRoom = stillInRoom
response.HasBeenInRoom = true
- evs, err := r.DB.Events(ctx, info, []types.EventNID{membershipEventNID})
+ evs, err := r.DB.Events(ctx, info.RoomVersion, []types.EventNID{membershipEventNID})
if err != nil {
return err
}
@@ -344,7 +344,7 @@ func (r *Queryer) QueryMembershipsForRoom(
}
return fmt.Errorf("r.DB.GetMembershipEventNIDsForRoom: %w", err)
}
- events, err = r.DB.Events(ctx, info, eventNIDs)
+ events, err = r.DB.Events(ctx, info.RoomVersion, eventNIDs)
if err != nil {
return fmt.Errorf("r.DB.Events: %w", err)
}
@@ -383,7 +383,7 @@ func (r *Queryer) QueryMembershipsForRoom(
return err
}
- events, err = r.DB.Events(ctx, info, eventNIDs)
+ events, err = r.DB.Events(ctx, info.RoomVersion, eventNIDs)
} else {
stateEntries, err = helpers.StateBeforeEvent(ctx, r.DB, info, membershipEventNID)
if err != nil {
@@ -967,7 +967,7 @@ func (r *Queryer) QueryRestrictedJoinAllowed(ctx context.Context, req *api.Query
// For each of the joined users, let's see if we can get a valid
// membership event.
for _, joinNID := range joinNIDs {
- events, err := r.DB.Events(ctx, roomInfo, []types.EventNID{joinNID})
+ events, err := r.DB.Events(ctx, roomInfo.RoomVersion, []types.EventNID{joinNID})
if err != nil || len(events) != 1 {
continue
}