From 4624e7a4858807f4b5330291d28818d03942f1c3 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 6 Jan 2016 16:46:29 +0000 Subject: [PATCH] Address review comments s/onClick/onSelect/ --- src/components/structures/RoomView.js | 12 +++++++++++- src/components/views/rooms/SearchResultTile.js | 9 +++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index daa429d79f..5f1ce2284d 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -618,7 +618,17 @@ module.exports = React.createClass({ if (this.state.searchScope === 'All') { var roomId = mxEv.getRoomId(); if(roomId != lastRoomId) { - ret.push(
  • Room: { cli.getRoom(roomId).name }

  • ); + var room = cli.getRoom(roomId); + + // XXX: if we've left the room, we might not know about + // it. We should tell the js sdk to go and find out about + // it. But that's not an issue currently, as synapse only + // returns results for rooms we're joined to. + var roomName = room ? room.name : "Unknown room "+roomId; + + ret.push(
  • +

    Room: { roomName }

    +
  • ); lastRoomId = roomId; } } diff --git a/src/components/views/rooms/SearchResultTile.js b/src/components/views/rooms/SearchResultTile.js index 73ed74b169..9d3af16ee7 100644 --- a/src/components/views/rooms/SearchResultTile.js +++ b/src/components/views/rooms/SearchResultTile.js @@ -23,9 +23,14 @@ module.exports = React.createClass({ displayName: 'SearchResult', propTypes: { + // a matrix-js-sdk SearchResult containing the details of this result searchResult: React.PropTypes.object.isRequired, + + // a list of strings to be highlighted in the results searchHighlights: React.PropTypes.array, - onClick: React.PropTypes.func, + + // callback to be called when the user selects this result + onSelect: React.PropTypes.func, }, render: function() { @@ -48,7 +53,7 @@ module.exports = React.createClass({ } if (EventTile.haveTileForEvent(ev)) { ret.push() + onHighlightClick={this.props.onSelect}/>) } } return (