Merge pull request #65 from matrix-org/rav/marker_at_top_of_search_results

Add a 'top-of-search' marker
pull/21833/head
Richard van der Hoff 2015-12-22 11:00:00 +00:00
commit 6b07de05f3
1 changed files with 16 additions and 0 deletions

View File

@ -521,6 +521,7 @@ module.exports = React.createClass({
searchResults: [],
searchHighlights: [],
searchCount: null,
searchCanPaginate: null,
});
this.savedSearchScrollState = {atBottom: true};
@ -579,6 +580,7 @@ module.exports = React.createClass({
searchHighlights: highlights,
searchResults: events,
searchCount: results.count,
searchCanPaginate: !!(results.next_batch),
});
self.nextSearchBatch = results.next_batch;
}, function(error) {
@ -639,6 +641,20 @@ module.exports = React.createClass({
var lastRoomId;
if (this.state.searchCanPaginate === false) {
if (this.state.searchResults.length == 0) {
ret.push(<li key="search-top-marker">
<h2 className="mx_RoomView_topMarker">No results</h2>
</li>
);
} else {
ret.push(<li key="search-top-marker">
<h2 className="mx_RoomView_topMarker">No more results</h2>
</li>
);
}
}
for (var i = this.state.searchResults.length - 1; i >= 0; i--) {
var result = this.state.searchResults[i];
var mxEv = new Matrix.MatrixEvent(result.result);