Page MenuHomePhabricator

Sort IP addresses properly in the Special:Investigate Compare results table
Open, Needs TriagePublic

Description

Since T237300, the Compare results table can be sorted by any column, as long as there is only one page of results. This is done using the jquery.tablesorter module.

IPv6 addresses do not yet sort properly, as identified in T237300#6215030.

Two things need to be done to fix this:

  1. Set the sort values for the IP addresses to their hex number representations, instead of their prettified string values (T257349)
  2. Handle hex number sorting in the tablesorter (T255693)

Event Timeline

Change 605330 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/extensions/CheckUser@master] ComparePager: Add sort values to the results for the tablesorter

https://gerrit.wikimedia.org/r/605330

Changing tablesorter to detect and sort hex (base 16) numbers correctly seems tricky.

Why not convert the base 16 number representations back to base 10? It's the same number, it'll sort correctly, and they are not displayed anywhere anyway, just used in data-sort-value.

IPv6 addresses would present a small problem, since they're 128-bit, so they probably wouldn't be sorted correctly as JavaScript can't represent them precisely (MAX_SAFE_INTEGER is 53-bit). You can work around that by splitting them into smaller chunks, e.g. 32-bit (8 hex digits), and putting those in data-sort-value (separated by spaces).