Page MenuHomePhabricator

How should infobox handle pagination in Special:Contributions for temporary accounts?
Closed, ResolvedPublic

Description

Problem

Currently, the infobox on Special:Contributions looks up the revision of the top entry on the page. If you change pages, the top entry of the page will be different and so the revision looked up by the infobox will be different.

If a temporary user is using different IPs, the data shown by the infobox might change per page.

Example

From my local environment, somewhat unrealistic because I have set the number of entries per page to 1, but the same principle applies for a larger limit.

First page of Special:Contributions:

page1.png (781×1 px, 132 KB)

Second page, IP information is different:

page2.png (767×1 px, 128 KB)

Event Timeline

Hi @dom_walden, @Niharika and I are not sure we understand the issue.

IP Info isn't a table so it doesn't have pagination? Is the issue that we need to explain that the IP Infobox is showing information for the last used IP address of a temp account? Could you further clarify the problem we are trying to solve? Thanks!

IP Info isn't a table so it doesn't have pagination? Is the issue that we need to explain that the IP Infobox is showing information for the last used IP address of a temp account?

I am referring to the pagination on Special:Contributions, not the IPInfo infobox itself. If a users contributions are over several pages of Special:Contributions, the IP whose information is shown in the infobox will always be of the contribution that is at the top of the Special:Contributions page, not necessarily the most recent IP. Therefore, each page of Special:Contributions could be showing information for a different IP.

@dom_walden wrote:
I am referring to the pagination on Special:Contributions, not the IPInfo infobox itself. If a users contributions are over several pages of Special:Contributions, the IP whose information is shown in the infobox will always be of the contribution that is at the top of the Special:Contributions page, not necessarily the most recent IP. Therefore, each page of Special:Contributions could be showing information for a different IP.

Thank you for the clarification! I discussed this with @Niharika and we think there are two possible solutions: either don’t show IP Info on subsequent pages OR keep IP Info persistent across pages so it’s always showing the most recent IP.

hector.arroyo changed the task status from Open to In Progress.Jan 20 2025, 3:59 PM
hector.arroyo claimed this task.
hector.arroyo moved this task from Backlog to In Progress on the IP Info board.

Change #1112811 had a related patch set uploaded (by Harroyo-wmf; author: Harroyo-wmf):

[mediawiki/extensions/IPInfo@master] infobox: Show the infobox only for the first page of Special:Contributions

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

Patch https://gerrit.wikimedia.org/r/c/mediawiki/extensions/IPInfo/+/1112811 for hiding the infobox from all but the first page of Special:Contributions and Special:DeletedContributions is ready for review.

Change #1112811 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] infobox: Show IP info only for the first page of Special:Contributions

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

The fix https://gerrit.wikimedia.org/r/c/mediawiki/extensions/IPInfo/+/1112811 has been merged and is now ready for QA. Changes are:

  • IP info should only appear only for the first page of Special:Contributions and Special:DeletedContributions
  • IP info should still appear on all pages of Special:IPContributions when querying for a single IP
    • but it should not appear on any page of Special:IPContributions if querying by IP range (such as 172.18.0.0/28 -- this was the previous behavior)
  • Navigating backwards (i.e. using the link labeled as "earliest" that points to an URL having a dir=prev GET parameter like this) also hides the IPInfo box: In that case the first entry in the contributions list is not the last contribution and, therefore, does not point to the last IP used.

@hector.arroyo

The fix https://gerrit.wikimedia.org/r/c/mediawiki/extensions/IPInfo/+/1112811 has been merged and is now ready for QA. Changes are:

  • IP info should only appear only for the first page of Special:Contributions and Special:DeletedContributions

I am finding that on subsequent pages we are still making requests to rest.php/ipinfo/v0/revision/<rev id> in the background, even if we are not showing it on the page. So far, I have only seen it happen for IPs.

  • IP info should still appear on all pages of Special:IPContributions when querying for a single IP

What about Special:Contributions for IPs? It will always be the same IP here as well.

  • but it should not appear on any page of Special:IPContributions if querying by IP range (such as 172.18.0.0/28 -- this was the previous behavior)

This is also true for Special:Contributions. Ranges don't seem to work on Special:DeletedContributions.

  • Navigating backwards (i.e. using the link labeled as "earliest" that points to an URL having a dir=prev GET parameter like this) also hides the IPInfo box: In that case the first entry in the contributions list is not the last contribution and, therefore, does not point to the last IP used.

I don't know if we are reliably determining whether the first entry is the latest. For example:

  • If, from the first page, you click older n and then newer n to return to the first page, the dir=prev parameter is set so IPInfo does not appear, even though you are now back on the first page.
  • If, after clicking earliest, you change the limit parameter in the URL to be a number bigger than the total amount of revisions the user/IP has, all their revisions will be shown (including their most recent) but IPInfo will not be shown.
  • Navigating backwards (i.e. using the link labeled as "earliest" that points to an URL having a dir=prev GET parameter like this) also hides the IPInfo box: In that case the first entry in the contributions list is not the last contribution and, therefore, does not point to the last IP used.

I don't know if we are reliably determining whether the first entry is the latest. For example:

  • If, from the first page, you click older n and then newer n to return to the first page, the dir=prev parameter is set so IPInfo does not appear, even though you are now back on the first page.
  • If, after clicking earliest, you change the limit parameter in the URL to be a number bigger than the total amount of revisions the user/IP has, all their revisions will be shown (including their most recent) but IPInfo will not be shown.

I'm comfortable with not showing it if navigating backwards, even if we happen to be showing the latest revision. Pager behaviour can get a bit odd when navigating backwards anyway (e.g. seeing an incomplete page 1), and it seems easy enough to reload the first page if necessary.

@hector.arroyo

The fix https://gerrit.wikimedia.org/r/c/mediawiki/extensions/IPInfo/+/1112811 has been merged and is now ready for QA. Changes are:

  • IP info should only appear only for the first page of Special:Contributions and Special:DeletedContributions

I am finding that on subsequent pages we are still making requests to rest.php/ipinfo/v0/revision/<rev id> in the background, even if we are not showing it on the page. So far, I have only seen it happen for IPs.

  • IP info should still appear on all pages of Special:IPContributions when querying for a single IP

What about Special:Contributions for IPs? It will always be the same IP here as well.

Would both of these be fixed if we showed the infobox on every page if the target is a single IP address, for Contributions, DeletedContributions and IPContributions?

  • Navigating backwards (i.e. using the link labeled as "earliest" that points to an URL having a dir=prev GET parameter like this) also hides the IPInfo box: In that case the first entry in the contributions list is not the last contribution and, therefore, does not point to the last IP used.

I don't know if we are reliably determining whether the first entry is the latest. For example:

  • If, from the first page, you click older n and then newer n to return to the first page, the dir=prev parameter is set so IPInfo does not appear, even though you are now back on the first page.
  • If, after clicking earliest, you change the limit parameter in the URL to be a number bigger than the total amount of revisions the user/IP has, all their revisions will be shown (including their most recent) but IPInfo will not be shown.

I'm comfortable with not showing it if navigating backwards, even if we happen to be showing the latest revision. Pager behaviour can get a bit odd when navigating backwards anyway (e.g. seeing an incomplete page 1), and it seems easy enough to reload the first page if necessary.

The implementation explicitly checks if the user is on the first page (it checks if the offset is zero (or is not provided)) and that the user is not navigating backwards (i.e. dir=prev).

IIRC that was because the javascript code picks the first revId listed in the page (the one at the top of the listing of contributions), and that won't match the last edit if we are not listing in the "normal" order nor on the first page. In the former case, the last revision is indeed in the page but we'd need to tweak the javascript code to pick a different ID (first or last one) depending on the dir parameter. This is to ensure that we always show the last IP without complicating the implementation too much.

Would both of these be fixed if we showed the infobox on every page if the target is a single IP address, for Contributions, DeletedContributions and IPContributions?

For me this solution would be fine, and doesn't seem like something difficult to do (just tweaking a single 2-line method that currently holds the conditions for showing the infobox).

Could we use the norevision endpoint, which I believe always returns the latest IP for a user (although this includes logged and private events, not just edits)? We seem to already use this endpoint on Special:[Deleted/IP]Contributions when there are no revisions.

Could we use the norevision endpoint, which I believe always returns the latest IP for a user (although this includes logged and private events, not just edits)? We seem to already use this endpoint on Special:[Deleted/IP]Contributions when there are no revisions.

Right now, we use norevision if the user is a TempUser and the list of contributions is empty. The endpoint seems to reject lookups for named accounts (normal, non-temporary users), and retrieves the last IP as you pointed out (getMostRecentAddress( $user )).

I think we can change the condition in the frontend code to always use norevision for temp (and IP?) users regardless of the contents in the list of contributions.

Change #1122576 had a related patch set uploaded (by Harroyo-wmf; author: Harroyo-wmf):

[mediawiki/extensions/IPInfo@master] infobox: Always use the norevision endpoint for temp users

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

Could we use the norevision endpoint, which I believe always returns the latest IP for a user (although this includes logged and private events, not just edits)? We seem to already use this endpoint on Special:[Deleted/IP]Contributions when there are no revisions.

Right now, we use norevision if the user is a TempUser and the list of contributions is empty. The endpoint seems to reject lookups for named accounts (normal, non-temporary users), and retrieves the last IP as you pointed out (getMostRecentAddress( $user )).

I think we can change the condition in the frontend code to always use norevision for temp (and IP?) users regardless of the contents in the list of contributions.

We probably shouldn't do this, in case the latest edit might is not the latest action that recorded an IP (e.g. if an AbuseFilter was tripped from a different IP since the last edit was made). It makes sense when there are no contributions, but when there are contributions we should show IP info for the most recent contribution.

Could we use the norevision endpoint, which I believe always returns the latest IP for a user (although this includes logged and private events, not just edits)? We seem to already use this endpoint on Special:[Deleted/IP]Contributions when there are no revisions.

Right now, we use norevision if the user is a TempUser and the list of contributions is empty. The endpoint seems to reject lookups for named accounts (normal, non-temporary users), and retrieves the last IP as you pointed out (getMostRecentAddress( $user )).

I think we can change the condition in the frontend code to always use norevision for temp (and IP?) users regardless of the contents in the list of contributions.

We probably shouldn't do this, in case the latest edit might is not the latest action that recorded an IP (e.g. if an AbuseFilter was tripped from a different IP since the last edit was made). It makes sense when there are no contributions, but when there are contributions we should show IP info for the most recent contribution.

Makes sense to me. Then, I think we can keep the current Javascript logic (fetch data from the first revision listed but, if there is none AND the user is temp, use the norevision endpoint; otherwise show the "no edits" error).

The current logic shows the infobox for all pages in IPContributions, but only for the first one in Contributions and DeletedContributions. For those last two, should we show it in all pages (instead of showing it only in the first one) if the target is an IP?

The current logic shows the infobox for all pages in IPContributions, but only for the first one in Contributions and DeletedContributions. For those last two, should we show it in all pages (instead of showing it only in the first one) if the target is an IP?

That makes sense to me, yes.

Change #1122641 had a related patch set uploaded (by Harroyo-wmf; author: Harroyo-wmf):

[mediawiki/extensions/IPInfo@master] ipcontributions: Show info in all pages for requestes targeting an IP.

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

Change #1122576 abandoned by Harroyo-wmf:

[mediawiki/extensions/IPInfo@master] infobox: Always use the norevision endpoint for temp users

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

Patch https://gerrit.wikimedia.org/r/c/mediawiki/extensions/IPInfo/+/1122641 is now ready for review.

I'm moving this back to "Needs review".

Change #1122641 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] ipcontributions: Show info in all pages for requests targeting an IP.

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

IPInfo now appears on each page of Special:Contributions, DeletedContributions and IPContributions for IPs.

Everything else I tested appeared to work as before.

Test environment: local docker IP Info 0.0.0 (ab5750e) 13:26, 27 February 2025.