Address review comments

s/onClick/onSelect/
This commit is contained in:
Richard van der Hoff 2016-01-06 16:46:29 +00:00
parent 75302b1f97
commit 4624e7a485
2 changed files with 18 additions and 3 deletions

View file

@ -618,7 +618,17 @@ module.exports = React.createClass({
if (this.state.searchScope === 'All') { if (this.state.searchScope === 'All') {
var roomId = mxEv.getRoomId(); var roomId = mxEv.getRoomId();
if(roomId != lastRoomId) { if(roomId != lastRoomId) {
ret.push(<li key={mxEv.getId() + "-room"}><h1>Room: { cli.getRoom(roomId).name }</h1></li>); 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(<li key={mxEv.getId() + "-room"}>
<h1>Room: { roomName }</h1>
</li>);
lastRoomId = roomId; lastRoomId = roomId;
} }
} }

View file

@ -23,9 +23,14 @@ module.exports = React.createClass({
displayName: 'SearchResult', displayName: 'SearchResult',
propTypes: { propTypes: {
// a matrix-js-sdk SearchResult containing the details of this result
searchResult: React.PropTypes.object.isRequired, searchResult: React.PropTypes.object.isRequired,
// a list of strings to be highlighted in the results
searchHighlights: React.PropTypes.array, searchHighlights: React.PropTypes.array,
onClick: React.PropTypes.func,
// callback to be called when the user selects this result
onSelect: React.PropTypes.func,
}, },
render: function() { render: function() {
@ -48,7 +53,7 @@ module.exports = React.createClass({
} }
if (EventTile.haveTileForEvent(ev)) { if (EventTile.haveTileForEvent(ev)) {
ret.push(<EventTile key={eventId+"+"+j} mxEvent={ev} contextual={contextual} highlights={highlights} ret.push(<EventTile key={eventId+"+"+j} mxEvent={ev} contextual={contextual} highlights={highlights}
onHighlightClick={this.props.onClick}/>) onHighlightClick={this.props.onSelect}/>)
} }
} }
return ( return (