mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 21:12:45 +00:00
Add some roomserver UTs (#3067)
Adds tests for `QueryRestrictedJoinAllowed`, `IsServerAllowed` and `PerformRoomUpgrade`. Refactors the `QueryRoomVersionForRoom` method to accept a string and return a `gmsl.RoomVersion` instead of req/resp structs. Adds some more caching for `GetStateEvent` This should also fix #2912 by ignoring state events belonging to other users.
This commit is contained in:
parent
dd5e47a9a7
commit
2475cf4b61
20 changed files with 705 additions and 135 deletions
|
@ -325,10 +325,8 @@ func (rc *reqCtx) fetchUnknownEvent(eventID, roomID string) *gomatrixserverlib.H
|
|||
}
|
||||
logger := util.GetLogger(rc.ctx).WithField("room_id", roomID)
|
||||
// if they supplied a room_id, check the room exists.
|
||||
var queryVerRes roomserver.QueryRoomVersionForRoomResponse
|
||||
err := rc.rsAPI.QueryRoomVersionForRoom(rc.ctx, &roomserver.QueryRoomVersionForRoomRequest{
|
||||
RoomID: roomID,
|
||||
}, &queryVerRes)
|
||||
|
||||
roomVersion, err := rc.rsAPI.QueryRoomVersionForRoom(rc.ctx, roomID)
|
||||
if err != nil {
|
||||
logger.WithError(err).Warn("failed to query room version for room, does this room exist?")
|
||||
return nil
|
||||
|
@ -367,7 +365,7 @@ func (rc *reqCtx) fetchUnknownEvent(eventID, roomID string) *gomatrixserverlib.H
|
|||
// Inject the response into the roomserver to remember the event across multiple calls and to set
|
||||
// unexplored flags correctly.
|
||||
for _, srv := range serversToQuery {
|
||||
res, err := rc.MSC2836EventRelationships(eventID, srv, queryVerRes.RoomVersion)
|
||||
res, err := rc.MSC2836EventRelationships(eventID, srv, roomVersion)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue