mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-09 15:13:12 -06:00
fix 2 bugs
- CSAPI used wrong function to create pagination cache (which caused nil map errs) - Copied an array wrong in room hierarchy impl, which caused a nil room list to return
This commit is contained in:
parent
14f8b30291
commit
19d420e3b2
|
|
@ -509,14 +509,14 @@ func Setup(
|
|||
|
||||
// Defined outside of handler to persist between calls
|
||||
// TODO: clear based on some criteria
|
||||
roomHierarchyPaginationCache := new(RoomHierarchyPaginationCache)
|
||||
roomHierarchyPaginationCache := NewRoomHierarchyPaginationCache()
|
||||
v1mux.Handle("/rooms/{roomID}/hierarchy",
|
||||
httputil.MakeAuthAPI("spaces", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse {
|
||||
vars, err := httputil.URLDecodeMapValues(mux.Vars(req))
|
||||
if err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
return QueryRoomHierarchy(req, device, vars["roomID"], rsAPI, roomHierarchyPaginationCache)
|
||||
return QueryRoomHierarchy(req, device, vars["roomID"], rsAPI, &roomHierarchyPaginationCache)
|
||||
}, httputil.WithAllowGuests()),
|
||||
).Methods(http.MethodGet, http.MethodOptions)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ func (querier *Queryer) QueryNextRoomHierarchyPage(ctx context.Context, walker r
|
|||
return nil, nil, roomserver.ErrRoomUnknownOrNotAllowed{Err: fmt.Errorf("room is unknown/forbidden")}
|
||||
}
|
||||
|
||||
var discoveredRooms []fclient.MSC2946Room
|
||||
discoveredRooms := []fclient.MSC2946Room{}
|
||||
|
||||
// Copy unvisited and processed to avoid modifying walker
|
||||
unvisited := []roomserver.RoomHierarchyWalkerQueuedRoom{}
|
||||
// Copy unvisited and processed to avoid modifying original walker (which is typically in cache)
|
||||
unvisited := make([]roomserver.RoomHierarchyWalkerQueuedRoom, len(walker.Unvisited))
|
||||
copy(unvisited, walker.Unvisited)
|
||||
processed := walker.Processed.Copy()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue