freedomofpress / securethenews

An automated scanner and web dashboard for tracking TLS deployment across news organizations
https://securethe.news
GNU Affero General Public License v3.0
101 stars 29 forks source link

Updates lodash orderBy to use values instead of the key string #356

Closed SaptakS closed 3 years ago

SaptakS commented 3 years ago

Fixes #332

As mentioned in the code comments, onion_available along with most other boolean fields allow for null because it may not be possible to determine their values (for example, if the site is down at the time of the scan).

I have hence changed the way we do orderBy (since most of the orderBy fields involve a Nullable Boolean field). Lodash can handle both the values and the key to sort by. So in this PR I have updated such that it uses the value, and anytime the value is null, it uses blank string '' instead.

SaptakS commented 3 years ago

A good follow up, which probably needs a separate issue/PR is if we want to represent this null values as a separate icon, or something to make it clearer.