[tor-commits] [atlas/master] Added default values for fields that could be empty

irl at torproject.org irl at torproject.org
Thu Mar 2 13:40:20 UTC 2017


commit 2750db45005a90465387ed1e982484981cc980b0
Author: Raphael Bergmann <raphael at cc-ltd.net>
Date:   Tue Jan 31 14:45:19 2017 +0100

    Added default values for fields that could be empty
---
 templates/details/bridge.html |  4 ++--
 templates/details/router.html | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/templates/details/bridge.html b/templates/details/bridge.html
index f905247..0398b11 100644
--- a/templates/details/bridge.html
+++ b/templates/details/bridge.html
@@ -23,7 +23,7 @@
       <dt>
       <span class="tip" title="Bandwidth that the bridge is willing and able to provide in bytes per second." data-original-title="Advertised bandwidth">Advertised Bandwidth</span>
       </dt>
-      <dd><%= relay.get('bandwidth_hr') %></dd>
+      <dd><%= relay.get('bandwidth_hr') ? relay.get('bandwidth_hr') : 'not defined' %></dd>
     </dl>
 
 
@@ -58,7 +58,7 @@
     <dd><%= _.escape(relay.get('platform')) %></dd>
 
     <dt><span class="tip" title="Transport protocols supported by this bridge." data-original-title="Transport protocols">Transport protocols</span></dt>
-    <dd><%= relay.get('transports') %></dd>
+    <dd><%= relay.get('transports') ? relay.get('transports') : 'none' %></dd>
 
     </dl>
     </div>
diff --git a/templates/details/router.html b/templates/details/router.html
index 73bf5a8..b773432 100644
--- a/templates/details/router.html
+++ b/templates/details/router.html
@@ -21,10 +21,10 @@
       <dd><%= relay.get('or_addresses') %></dd>
 
       <dt><span class="tip" title="These are the contact details of the Tor relay operator" data-original-title="ContactInfo">Contact</span></dt>
-      <dd><%= _.escape(relay.get('contact')) %></dd>
+      <dd><%= _.escape( relay.get('contact')!='undefined' ? relay.get('contact') : 'none' ) %></dd>
 
       <dt><span class="tip" title="Address and port where the relay listens for directory requests." data-original-title="Directory port">Dir Address</span></dt>
-      <dd><%= relay.get('dir_address') %></dd>
+      <dd><%= relay.get('dir_address') ? relay.get('dir_address') : 'none' %></dd>
 
       <dt>
       <span class="tip" title="Bandwidth that the relay is willing and able to provide in bytes per second." data-original-title="Advertised bandwidth">Advertised Bandwidth</span>
@@ -48,7 +48,7 @@
         <pre class="pre-scrollable">reject<% _.each(relay.get('exit_policy_v6_summary')['reject'],
           function(ports) { %><br>  <%= $.trim(ports) %><% });} %></pre>
       <% if (relay.get('exit_policy_v6_summary') == null) { %>
-        <pre class="pre-scrollable">None defined.</pre>
+        <pre class="pre-scrollable">none defined</pre>
       <% } %>
       </dd>
       <dt><span class="tip" title="Policy of exit connections that the relay is going to accept or reject." data-original-title="Exit policy">Exit Policy</span></dt>
@@ -100,14 +100,14 @@
         Effective family members:<br>
         <pre><% if (relay.get('effective_family') !== null) { %><% _.each(relay.get('effective_family'), function(member) { %><% var valid = member.match(RegExp("^\$[A-F0-9]{40}$")); %>
 <% if (valid) { %><a href="#details/<%= member.replace('$', '') %>" title="Effective family member"><% } %><%= member %><% if (valid) { %></a><% }}); %>
-<% } %></pre>
+<% } %><% if (relay.get('effective_family') == null) { %>none<% } %></pre>
         Alleged family members:<br>
         <pre><% if (relay.get('alleged_family') !== null) { %><% _.each(relay.get('alleged_family'), function(member) { %><% var valid = member.match(RegExp("^\$[A-F0-9]{40}$")); %>
-<% if (valid) { %><a href="#details/<%= member.replace('$', '') %>" title="Alleged family member" class="alleged"><% } %><%= member %><% if (valid) { %></a><% }}); %><% } %></pre>
+<% if (valid) { %><a href="#details/<%= member.replace('$', '') %>" title="Alleged family member" class="alleged"><% } %><%= member %><% if (valid) { %></a><% }}); %><% } %><% if (relay.get('alleged_family') == null) { %>none<% } %></pre>
     </dd>
 
     <dt><span class="tip" title="Date and time when the relay last published a descriptor to the directory authorities." data-original-title="Descriptor published">Descriptor Published</span></dt>
-    <dd><%= relay.get('desc_published') %></dd>
+    <dd><%= relay.get('desc_published') ? relay.get('desc_published') : 'never' %></dd>
 
     <dt><span class="tip" title="What OS and Tor version the relay is using" data-original-title="Platform">Platform</span></dt>
     <dd><%= _.escape(relay.get('platform')) %></dd>



More information about the tor-commits mailing list