From ffeaf2dec00b99b6223f2a23a88bfeb6da2f1924 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 8 Feb 2017 09:20:23 +0000 Subject: [PATCH] searchMessageText: avoid setting keys=undefined This doesn't make any difference to the JSON, but it upsets `expect`. --- src/client.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/client.js b/src/client.js index c6026ade2..162f596d8 100644 --- a/src/client.js +++ b/src/client.js @@ -2286,13 +2286,18 @@ MatrixClient.prototype.setRoomMutePushRule = function(scope, roomId, mute) { * @return {module:http-api.MatrixError} Rejects: with an error response. */ MatrixClient.prototype.searchMessageText = function(opts, callback) { + const roomEvents = { + search_term: opts.query, + }; + + if ('keys' in opts) { + roomEvents.keys = opts.keys; + } + return this.search({ body: { search_categories: { - room_events: { - keys: opts.keys, - search_term: opts.query, - }, + room_events: roomEvents, }, }, }, callback);