From 05d96f4cfbadad47eee2e688dea28cdb0533f89a Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 29 Oct 2015 18:28:23 +0000 Subject: [PATCH] fix filters, and stop react exploding on unrecognised event tiles --- src/controllers/organisms/RoomView.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/controllers/organisms/RoomView.js b/src/controllers/organisms/RoomView.js index 1df1bdb3bd..c0077bc0b7 100644 --- a/src/controllers/organisms/RoomView.js +++ b/src/controllers/organisms/RoomView.js @@ -363,13 +363,10 @@ module.exports = { var filter; if (scope === "Room") { // FIXME: should be enum filter = { - room: { - timeline: { - rooms: [ - this.props.roomId - ] - } - } + // XXX: it's unintuitive that the filter for searching doesn't have the same shape as the v2 filter API :( + rooms: [ + this.props.roomId + ] }; } @@ -414,18 +411,24 @@ module.exports = { var resultList = eventIds.map(function(key) { return results[key]; }).sort(function(a, b) { b.rank - a.rank }); for (var i = 0; i < resultList.length; i++) { var ts1 = resultList[i].result.origin_server_ts; - ret.push(
  • ); // Rank: {resultList[i].rank} + ret.push(
  • ); // Rank: {resultList[i].rank} var mxEv = new Matrix.MatrixEvent(resultList[i].result); if (resultList[i].context.events_before[0]) { var mxEv2 = new Matrix.MatrixEvent(resultList[i].context.events_before[0]); - ret.push(
  • ); + if (EventTile.supportsEventType(mxEv2.getType())) { + ret.push(
  • ); + } + } + if (EventTile.supportsEventType(mxEv.getType())) { + ret.push(
  • ); } - ret.push(
  • ); if (resultList[i].context.events_after[0]) { var mxEv2 = new Matrix.MatrixEvent(resultList[i].context.events_after[0]); - ret.push(
  • ); + if (EventTile.supportsEventType(mxEv2.getType())) { + ret.push(
  • ); + } } - } + } return ret; }