1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00

Merge pull request #357 from matrix-org/rav/search_no_undefined_keys

searchMessageText: avoid setting keys=undefined
This commit is contained in:
David Baker
2017-02-08 10:58:44 +00:00
committed by GitHub

View File

@@ -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);