From 9526deb024cf32bada1a6f56c857f4eb764e4054 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 8 Nov 2015 16:19:53 +0000 Subject: [PATCH] add error dialogs and order search results by recents --- src/controllers/organisms/RoomView.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/controllers/organisms/RoomView.js b/src/controllers/organisms/RoomView.js index f5a8d28f2..b60941c2c 100644 --- a/src/controllers/organisms/RoomView.js +++ b/src/controllers/organisms/RoomView.js @@ -350,8 +350,12 @@ module.exports = { self.setState({ upload: undefined }); - }).done(undefined, function() { - // display error message + }).done(undefined, function(error) { + var ErrorDialog = sdk.getComponent("organisms.ErrorDialog"); + Modal.createDialog(ErrorDialog, { + title: "Failed to upload file", + description: error.toString() + }); }); }, @@ -377,6 +381,7 @@ module.exports = { room_events: { search_term: term, filter: filter, + order_by: "recent", event_context: { before_limit: 1, after_limit: 1, @@ -390,7 +395,11 @@ module.exports = { searchResults: data, }); }, function(error) { - // TODO: show dialog or something + var ErrorDialog = sdk.getComponent("organisms.ErrorDialog"); + Modal.createDialog(ErrorDialog, { + title: "Search failed", + description: error.toString() + }); }); }, @@ -408,7 +417,7 @@ module.exports = { var eventIds = Object.keys(results); // XXX: todo: merge overlapping results somehow? // XXX: why doesn't searching on name work? - var resultList = eventIds.map(function(key) { return results[key]; }).sort(function(a, b) { b.rank - a.rank }); + 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}