[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [atlas/master] Exposes published timestamps on search and details pages (Fixes: #21959)



commit c9e5bbc0c09a425f568840bb4e2c50a10e909ccc
Author: Iain R. Learmonth <irl@xxxxxxxx>
Date:   Tue Nov 21 23:22:46 2017 +0000

    Exposes published timestamps on search and details pages (Fixes: #21959)
---
 js/collections/results.js     | 4 +++-
 js/models/relay.js            | 2 ++
 js/router.js                  | 4 +++-
 js/views/search/do.js         | 2 +-
 templates/details/bridge.html | 1 +
 templates/details/router.html | 2 ++
 templates/search/do.html      | 2 ++
 7 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/js/collections/results.js b/js/collections/results.js
index c64bdf0..da8a6a4 100644
--- a/js/collections/results.js
+++ b/js/collections/results.js
@@ -19,6 +19,8 @@ define([
                 this.fresh_until = response.fresh_until;
                 this.valid_after = response.valid_after;
                 var relays = [];
+                var relaysPublished = response.relays_published;
+                var bridgesPublished = response.bridges_published;
                 options.error = function(options) {
                     error(options.error, collection, options);
                 }
@@ -48,7 +50,7 @@ define([
                     var lookedUp = function() {
                       lookedUpRelays++;
                       if (lookedUpRelays == relays.length) {
-                        success(err);
+                        success(err, relaysPublished, bridgesPublished);
                       }
                     }
                     relay.lookup({
diff --git a/js/models/relay.js b/js/models/relay.js
index 9540ac9..1c0f89f 100644
--- a/js/models/relay.js
+++ b/js/models/relay.js
@@ -228,6 +228,8 @@ define([
                         relay.is_bridge = true;
                     }
                     if (relay) {
+                        relay.bridgesPublished = data.bridges_published;
+                        relay.relaysPublished = data.relays_published;
                         model.processRelay(options, model, relay);
                         success(model, relay);
                     } else {
diff --git a/js/router.js b/js/router.js
index 03553fc..fce9e0a 100644
--- a/js/router.js
+++ b/js/router.js
@@ -71,7 +71,7 @@ define([
             doSearchView.collection.url =
                 doSearchView.collection.baseurl + this.hashFingerprint(query);
             doSearchView.collection.lookup({
-                success: function(err){
+                success: function(err, relaysPublished, bridgesPublished){
                     doSearchView.relays = doSearchView.collection.models;
 
                     // Redirect to the details page when there is exactly one
@@ -82,6 +82,8 @@ define([
                         return;
                     }
 		    doSearchView.error = err;
+                    doSearchView.relaysPublished = relaysPublished;
+                    doSearchView.bridgesPublished = bridgesPublished;
                     doSearchView.render(query);
 		    $("#search-title").text(query);
                     $(".progress").hide();
diff --git a/js/views/search/do.js b/js/views/search/do.js
index 3aa50fe..c1f789d 100644
--- a/js/views/search/do.js
+++ b/js/views/search/do.js
@@ -20,7 +20,7 @@ define([
         render: function(query){
             document.title = "Relay Search";
             var asInitVals = new Array();
-            var compiledTemplate = _.template(doSearchTemplate, {query: query, relays: this.relays, countries: CountryCodes, error: this.error});
+            var compiledTemplate = _.template(doSearchTemplate, {query: query, relays: this.relays, countries: CountryCodes, error: this.error, relaysPublished: this.relaysPublished, bridgesPublished: this.bridgesPublished});
 			this.el.html(compiledTemplate);
             var fp = this;
             loadSortingExtensions();
diff --git a/templates/details/bridge.html b/templates/details/bridge.html
index f8b7f8e..7b8a40a 100644
--- a/templates/details/bridge.html
+++ b/templates/details/bridge.html
@@ -202,4 +202,5 @@
         </div>
     </div>
   </div>
+<p>Information for bridges was published: <%= relay.get('bridgesPublished') %>.</p>
 
diff --git a/templates/details/router.html b/templates/details/router.html
index e2a4065..2f8a323 100644
--- a/templates/details/router.html
+++ b/templates/details/router.html
@@ -285,3 +285,5 @@
 </div>
 
 </div><!-- container-fluid -->
+
+<p>Information for relays was published: <%= relay.get('relaysPublished') %>.</p>
diff --git a/templates/search/do.html b/templates/search/do.html
index f98dd54..1b24d21 100644
--- a/templates/search/do.html
+++ b/templates/search/do.html
@@ -134,6 +134,8 @@ family size for the relay including the relay itself. A size of 1 indicates
 that the relay does not have any other effective family members. Note that
 bridge relays do not advertise family members in their descriptors and so there
 is no value shown for bridge relays.</p>
+<p>Information for relays was published: <%= relaysPublished %>.<br>
+Information for bridges was published: <%= bridgesPublished %>.</p>
 <% } %>
 </div>
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits