Fix bug with the /hierarchy API sending invalid requests (#2201)

This commit is contained in:
Michael Telatynski
2022-02-24 14:49:48 +00:00
committed by GitHub
parent 946f47e037
commit 735ccca18b
+14 -5
View File
@@ -8744,12 +8744,21 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
$roomId: roomId,
});
return this.http.authedRequest<IRoomHierarchy>(undefined, Method.Get, path, {
const queryParams: Record<string, string | string[]> = {
suggested_only: String(suggestedOnly),
max_depth: maxDepth?.toString(),
from: fromToken,
limit: limit?.toString(),
}, undefined, {
};
if (limit !== undefined) {
queryParams["limit"] = limit.toString();
}
if (maxDepth !== undefined) {
queryParams["max_depth"] = maxDepth.toString();
}
if (fromToken !== undefined) {
queryParams["from"] = fromToken;
}
return this.http.authedRequest<IRoomHierarchy>(undefined, Method.Get, path, queryParams, undefined, {
prefix: "/_matrix/client/unstable/org.matrix.msc2946",
}).catch(e => {
if (e.errcode === "M_UNRECOGNIZED") {