Page MenuHomePhabricator

IP Info's infobox on Special:Contributions can load without guaranteeing content loading [S]
Closed, ResolvedPublic

Description

The infobox accordion is generated and output via php in InfoboxHandler.php:

		$panelLayout = new PanelLayout( [
			'classes' => [ 'ext-ipinfo-panel-layout' ],
			'framed' => true,
			'expanded' => false,
			'padded' => true,
			'content' => ( new CollapsibleFieldsetLayout(
				[
					'label' => $out->getContext()->msg( 'ipinfo-infobox-title' ),
					'collapsed' => true,
					'classes' => [ 'ext-ipinfo-collapsible-layout' ],
					'infusable' => true,
				]
			) ),
		] );
		OutputPage::setupOOUI();
		$out->addHTML( $panelLayout );

And the content is appended in infoBox/init.js:

$( '.ext-ipinfo-collapsible-layout .mw-collapsible-content' ).append( ipPanelWidget.$element );

However, init.js can return early:

( function () {
	var ip = mw.config.get( 'wgIPInfoTarget' ),
		revId, ipPanelWidget;
	if ( !ip ) {
		return;
	}

	revId = $( '.mw-contributions-list [data-mw-revid]' ).first().attr( 'data-mw-revid' );
	if ( !revId ) {
		return;
	}

Which means that the accordion will have been loaded without the content and no indication that content was intentionally not loaded.

We should decide if this is a bug or a feature 😅 and how we want to fix it. Possible solutions are:

  • Add an error message
  • Remove the accordion using js if we're early returning
  • Generate the accordion in js as well*

*this has the benefit of working for no-js cases as well.

AC:
  • When the IP Info box loads without content, add this error message:

IP Information for this address cannot be retrieved since it hasn't made any edits on this wiki.

  • Error state design from figma:

image.png (268×1 px, 27 KB)

Event Timeline

Add an error message

Can we instead show a loading state and then show the data when it becomes available?

Add an error message

Can we instead show a loading state and then show the data when it becomes available?

The data will never be available because it's intentionally not loaded. That happens when the user doesn't have any log items on their Special:Contributions page:

image.png (348×501 px, 22 KB)

@STran can you elaborate on why the data is intentionally not loaded? Are we showing data only for IPs which have had at least one edit?

Sure. The technical reason is that IP Info's API looks for a revision or a log id and gets the ip from that. If there are no edits, there are no log entries to get an ip from. The design decision was made before my time but iirc I it's so that no one could use IP Info as a proxy for getting all ip info (eg. I go to Special:Contributions/<any ip> and get ip info on it or I go to the API and input an ip and get info from it).

Thanks @STran! Does this mean that this issue only effects Special:Contribs for those IPs that have never made any edits?

I am trying to think of ways a user could get to Special:Contribs for an IP that hasn't made any edits or logged actions besides editing the URL directly. I am not sure if there are any?

Thanks @STran! Since we don't want IP Info to be a generic IP lookup tool I think it makes sense to show an error here using the default error state. Error message:

IP Information for this IP address cannot be retrieved since it hasn't made any edits on this wiki.

Questions:

  • Does this apply only when the IP hasn't made edits on this particular wiki?
  • De we got IP info even if the wiki has made edits on other languages or projects?

I am trying to think of ways a user could get to Special:Contribs for an IP that hasn't made any edits or logged actions besides editing the URL directly. I am not sure if there are any?

I think that's right. I see it a lot testing locally (and presuming other people testing locally see it a lot) because the IPs we test against usually don't have edits unless we manually edit them in the db. I don't know how common this would be in real application.

Questions:

  • Does this apply only when the IP hasn't made edits on this particular wiki?
  • De we got IP info even if the wiki has made edits on other languages or projects?
  • Yes I believe so. It relies on whatever Special:Contributions sees as the user's history (which is presumably only local)
  • I'm not sure I understand this question. I don't think local wikis are aware of other wikis (unless there's a global user?). I think the answer for this question might be the same as above? Whatever Special:Contributions says for that user on that wiki.

Thanks @STran. In my understanding, we can show an error message for now. @Niharika, I suspect that this might change with IP masking especially if whatever approach we take has to be global in some way. Do we need to address that here in any way?

Thanks @STran. In my understanding, we can show an error message for now. @Niharika, I suspect that this might change with IP masking especially if whatever approach we take has to be global in some way. Do we need to address that here in any way?

I think we can address it when the IP Masking change happens. @Prtksxna can you add the error message to the ticket description criteria?

ARamirez_WMF renamed this task from IP Info's infobox on Special:Contributions can load without guaranteeing content loading to IP Info's infobox on Special:Contributions can load without guaranteeing content loading [S].Nov 3 2021, 4:25 PM
phuedx subscribed.

Unlicking this 🍪 as I'm currently knee deep in creating tasks.

Change 743117 had a related patch set uploaded (by STran; author: STran):

[mediawiki/extensions/IPInfo@master] Add error messages for infobox

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

Change 743117 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] Add error messages for infobox

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

Verified message shows for IP users with no edits, tested in supported browsers:

Screen Shot 2021-12-09 at 3.20.02 PM.png (1×3 px, 469 KB)

Screen Shot 2021-12-09 at 3.58.44 PM.png (1×2 px, 2 MB)