[tor-commits] [atlas/master] Go to the details page when there is one result

irl at torproject.org irl at torproject.org
Thu Mar 2 14:31:29 UTC 2017


commit 95acc1b94935374f209d3c9d6b342a476437f6d1
Author: cypherpunks <cypherpunks at torproject.org>
Date:   Thu Mar 2 13:38:07 2017 +0000

    Go to the details page when there is one result
    
    Closes #15415.
---
 js/router.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/js/router.js b/js/router.js
index 1253405..2c02dad 100644
--- a/js/router.js
+++ b/js/router.js
@@ -71,8 +71,16 @@ define([
                 doSearchView.collection.baseurl + this.hashFingerprints(query);
             doSearchView.collection.lookup({
                 success: function(err){
-                    $("#content").show();
                     doSearchView.relays = doSearchView.collection.models;
+
+                    // Redirect to the details page when there is exactly one
+                    // search result.
+                    if (doSearchView.relays.length == 1) {
+                        document.location = "#details/" +
+                            doSearchView.relays[0].fingerprint;
+                        return;
+                    }
+                    $("#content").show();
 		    doSearchView.error = err;
                     doSearchView.render(query);
 		    $("#search-title").text(query);



More information about the tor-commits mailing list