Page MenuHomePhabricator

Add IPInfo popup for imported WikiData revisions
Open, Needs TriagePublic

Description

From T310813: Investigate: IPInfo buttons not always showing on Special:RecentChanges [8H]

This ticket covers work to make imported WikiData revisions show the IPInfo popup, but if it happens to work for all imported revisions that's a bonus. Copy pasta-ing the rough problem and proposed solution from the investigation:

I'm looking at this example, which should hopefully be readily searchable:

image.png (204×868 px, 23 KB)

https://wikidata.beta.wmflabs.org/w/index.php?title=Q11&action=history (but viewing it from the https://en.wikipedia.beta.wmflabs.org/ Recent Changes page)

The problem appears to be twofold:

  1. There is no rev id associated with the edit on the current wiki. The edit appears to only exist on the wiki the data was imported from:

https://wikidata.beta.wmflabs.org/wiki/Special:Contributions/93.227.187.52 (edit exists) vs https://en.wikipedia.beta.wmflabs.org/wiki/Special:Contributions/93.227.187.52 (no edits)

  1. We don't consider these IPs to be anonymous. To compare, we use the existence of the .mw-anonuserlink class to find anonymous edits and pull the rev id from there:
<a href="/wiki/Special:Contributions/99.107.93.219" class="mw-userlink mw-anonuserlink ext-ipinfo-anonuserlink-loaded" title="Special:Contributions/99.107.93.219"><bdi>99.107.93.219</bdi></a>

and the relevant api call: https://en.wikipedia.beta.wmflabs.org/w/rest.php/ipinfo/v0/revision/552620?dataContext=popup

vs an imported wikidata entry:

<a class="extiw" href="https://wikidata.beta.wmflabs.org/wiki/Special:Contributions/93.227.187.52">93.227.187.52</a>

so we'd never check for a rev id in any case.


I did notice that IP Info is installed on the wikidata.beta server and trying to hit https://wikidata.beta.wmflabs.org/w/rest.php/ipinfo/v0/revision/1305332?dataContext=popup gives me a 403 error which is expected, since I don't have permission on that wiki.

Additionally, I noticed when I tried importing edits to wiki pages, the edits were successfully imported as revisions I could look up the IPs for. This seems to be an issue that arises with how we manage these other data types (in that we don't duplicate the change but instead appear to maintain a reference to the original change). I'm not sure there's a "best practice" way to resolve this, given the ownership of data is split across 2 wikis without doing something invasive further upstream and with the potential for large side effects. There's possibly a hacky way around this and it could look like:

  1. Check against .extiw and other "external" changes and see if the user is an IP.
  2. If it is, get the rev id (can be found in the diff link eg. https://wikidata.beta.wmflabs.org/w/index.php?title=Special%3AEntityPage%2FQ11&curid=24&diff=1305332&oldid=1305330 gets the rev id 1305332).
  3. Try to call the ipinfo api from the originating server.