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

[tor-commits] [globe/master] Switch to new effective and alleged family fields, and notice the difference between them



commit 67a74642e6ab1838ee4e2a00a5b4c262e1465a5f
Author: Cristóbal <cristobal.leiva@xxxxxxxx>
Date:   Thu Sep 10 15:52:02 2015 -0300

    Switch to new effective and alleged family fields, and notice the difference between them
---
 src/css/new-style.css            |    4 ++++
 src/js/models/OnionooDetail.js   |    8 ++++++++
 src/js/models/defaults.js        |    6 ++++--
 src/js/templates/relayDetail.hbs |   13 +++++++++----
 4 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/css/new-style.css b/src/css/new-style.css
index 34bac6e..58e2cda 100644
--- a/src/css/new-style.css
+++ b/src/css/new-style.css
@@ -456,6 +456,10 @@ code {
       background-color: #f7f7f7; }
     .item-list li:last-of-type {
       border-bottom: 0; }
+    .item-list li.alleged {
+      background-color: #ffe2c9; }
+    .item-list li.alleged:nth-child(even) {
+      background-color: #ffefe0; }
 
 .flags-list i.fa {
   margin-right: 10px; }
diff --git a/src/js/models/OnionooDetail.js b/src/js/models/OnionooDetail.js
index f229d90..6f4db42 100644
--- a/src/js/models/OnionooDetail.js
+++ b/src/js/models/OnionooDetail.js
@@ -27,6 +27,7 @@ GLOBE.OnionooDetail.reopenClass({
                     var relay = $.extend({}, defaults.relay, result.relays[i]);
                     var relayObj = GLOBE.OnionooRelayDetail.create(relay);
                     var relayLastSeenMoment = moment.utc(relayObj.get('last_seen'));
+                    var emptyFamily = true;
 
                     // check if consensus.relays and lastSeenMoment exist
                     if ( consensus.relays && relayLastSeenMoment &&
@@ -34,6 +35,13 @@ GLOBE.OnionooDetail.reopenClass({
                         consensus.relays.isValid() && relayLastSeenMoment.isValid()) {
                         relayObj.set('inLatestConsensus', consensus.relays.isSame(relayLastSeenMoment));
                     }
+                    
+                    // family field is replaced by the union of both effective and alleged family fields
+                    if( relayObj.effective_family.length > 0 || relayObj.alleged_family.length > 0 ) {
+                        emptyFamily = false;
+                    }
+
+                    relayObj.set('emptyFamily', emptyFamily);
 
                     details.relays.push(relayObj);
 
diff --git a/src/js/models/defaults.js b/src/js/models/defaults.js
index d5c2c29..667bb1f 100644
--- a/src/js/models/defaults.js
+++ b/src/js/models/defaults.js
@@ -23,7 +23,7 @@ GLOBE.defaults.OnionooBridgeDetail = {
 /**
  * default relay detail object
  * @see {@link https://onionoo.torproject.org/#details}
- * @type {{nickname: string, fingerprint: string, hashed_fingerprint: string, or_addresses: Array, exit_addresses: Array, dir_address: string, last_seen: string, last_changed_address_or_port: string, first_seen: string, running: null, flags: Array, country: string, country_name: string, region_name: string, city_name: string, latitude: number, longitude: number, as_number: string, as_name: string, consensus_weight: number, host_name: string, last_restarted: string, bandwidth_rate: number, bandwidth_burst: number, observed_bandwidth: number, advertised_bandwidth: number, exit_policy: Array, exit_policy_summary: Array, contact: string, platform: string, family: Array, advertised_bandwidth_fraction: number, consensus_weight_fraction: number, guard_probability: number, middle_probability: number, exit_probability: number}}
+ * @type {{nickname: string, fingerprint: string, hashed_fingerprint: string, or_addresses: Array, exit_addresses: Array, dir_address: string, last_seen: string, last_changed_address_or_port: string, first_seen: string, running: null, flags: Array, country: string, country_name: string, region_name: string, city_name: string, latitude: number, longitude: number, as_number: string, as_name: string, consensus_weight: number, host_name: string, last_restarted: string, bandwidth_rate: number, bandwidth_burst: number, observed_bandwidth: number, advertised_bandwidth: number, exit_policy: Array, exit_policy_summary: Array, contact: string, platform: string, family: Array (deprecated), effective_family: Array, alleged_family: Array, advertised_bandwidth_fraction: number, consensus_weight_fraction: number, guard_probability: number, middle_probability: number, exit_probability: number}}
  */
 GLOBE.defaults.OnionooRelayDetail = {
     nickname: 'Unnamed',
@@ -59,6 +59,8 @@ GLOBE.defaults.OnionooRelayDetail = {
     contact: '',
     platform: '',
     family: [],
+    effective_family: [],
+    alleged_family: [],
     advertised_bandwidth_fraction: -1,
     consensus_weight_fraction: -1,
     guard_probability: -1,
@@ -78,4 +80,4 @@ GLOBE.defaults.History = {
     factor: 1,
     count: 0,
     values: []
-};
\ No newline at end of file
+};
diff --git a/src/js/templates/relayDetail.hbs b/src/js/templates/relayDetail.hbs
index 1e9e449..ea7d133 100644
--- a/src/js/templates/relayDetail.hbs
+++ b/src/js/templates/relayDetail.hbs
@@ -171,11 +171,16 @@
                                 title="Other family members of this relay.">Family Members</h5>
                             <div class="property-content">
                                 <ul class="item-list">
-                                    {{#each family}}
-                                        <li><i {{action 'visitFamilyMember' this}} title="open family member details" class="button fa fa-external-link-square"></i> {{unbound familyToFingerprint this }}</li>
-                                    {{else}}
+                                    {{#if emptyFamily}}
                                         <li>none</li>
-                                    {{/each}}
+                                    {{else}}
+                                        {{#each effective_family}}
+                                            <li><i {{action 'visitFamilyMember' this}} title="open family member details" class="button fa fa-external-link-square"></i> {{unbound familyToFingerprint this }}</li>
+                                        {{/each}}
+                                        {{#each alleged_family}}
+                                            <li class="alleged"><i {{action 'visitFamilyMember' this}} title="open (alleged) family member details" class="button fa fa-external-link-square"></i> {{unbound familyToFingerprint this }}</li>
+                                        {{/each}}
+                                    {{/if}}
                                 </ul>
                             </div>
                         </div>



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