From 46fd36568affdb948ca3d632027ae56f2301d135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 4 Jun 2020 15:33:51 +0200 Subject: [PATCH] Searching: Always set the limit when searching. The spec doesn't mention any default limit so different homeservers might use different defaults, since we don't want Riot to behave differently depending on the homeserver bite the bullet of sending an additional 10 or so bytes when searching. --- src/Searching.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Searching.js b/src/Searching.js index 7ea1463a5e..f40e44a84d 100644 --- a/src/Searching.js +++ b/src/Searching.js @@ -22,15 +22,11 @@ const SEARCH_LIMIT = 10; async function serverSideSearch(term, roomId = undefined, processResult = true) { const client = MatrixClientPeg.get(); - let filter; - if (roomId !== undefined) { - // XXX: it's unintuitive that the filter for searching doesn't have - // the same shape as the v2 filter API :( - filter = { - rooms: [roomId], - limit: SEARCH_LIMIT, - }; - } + const filter = { + limit: SEARCH_LIMIT, + }; + + if (roomId !== undefined) filter.rooms = [roomId]; const body = { search_categories: {