Page MenuHomePhabricator

Update ApiQueryWatchlist to handle temporary users
Closed, ResolvedPublic

Description

ApiQueryWatchlist returns an anon flag to indicate an IP user. This flag is false for a temporary user, e.g.:

{
    "type": "edit",
    "ns": 0,
    "title": "Flour",
    "pageid": 161,
    "revid": 1625,
    "old_revid": 1624,
    "user": "*173",
    "anon": false,
    "bot": false,
    "new": false,
    "minor": false
}

This contradicts the RecentChanges feed, which categorizes temporary users with anonymous users, but agrees with the other APIs, which categorize temp users separately. It was agreed that we should do this in T337103: Decide a standard approach for classifying temporary, IP and registered users.

We should update ApiQueryWatchlist to add a temp flag for temporary users, and document in the code what the anon flag means.

QA Results - Local

Event Timeline

We should update ApiQueryWatchlist to add a temp flag for temporary users, and document in the code what the anon flag means.

I'm not 100% sure about this, having looked further.

The API has filters to hide anons, bots, minor and patrolled, similar to ApiFeedRecentChanges. The recent changes API categorizes temp users with anons, and I think it would be confusing if these filters behaved differently, so I guess this one should do that too.

I think we should add a 'temp' flag to match the other APIs (e.g. T351636)

But for the 'anon' flag, either it matches the anon filter or it matches the other APIs. I lean towards having temp=true and anon=false, and considering the name of the filter (anon/!anon) to be the problem. (Perhaps we could plan to rename the filter here and in recent changes, but making this kind of breaking change to the API won't be easy and won't be done quickly.)

Change 1007970 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/core@master] Group temporary users with IP users in ApiQueryWatchlist filters

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

Change 1007970 merged by jenkins-bot:

[mediawiki/core@master] Group temporary users with IP users in ApiQueryWatchlist filters

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

Testing notes

Flags

Example query (using Special:ApiSandbox):

Special:ApiSandbox#action=query&format=json&list=watchlist&formatversion=2&wlprop=ids|title|flags|user

(To see the temp/anon flags, prop=user is needed.)

Type of user making the editanon flagtemp flag
IP usertruefalse
Temp userfalsetrue
User with a full accountfalsefalse

Filters

Adding wlshow=!anon should only show edits by users with a full account.

Adding wlshow=anon should only show edits by IP users and temp accounts.

@Tchanders Flags for true/false match the specified users as seen from here. This task will be moved to Done. Thanks for all your work and notes!

Status: ✅PASS
Environment: Local: 1.42.0-alpha (787c00d) 15:52, 8 March 2024
OS: macOS Sonoma 14.2.1
Browser: Chrome 122
Skins. Vector 2022
Device: MBA M2
Emulated Device:: n/a
Test Links:
https://en.m.wikipedia.beta.wmflabs.org/wiki/Dog#
Special:ApiSandbox

✅AC1: https://phabricator.wikimedia.org/T358693

IP UserTemp UserUser w/Full Account
2024-03-05_15-26-48.png (850×3 px, 198 KB)
2024-03-08_11-55-39.png (638×3 px, 273 KB)
2024-03-05_15-20-34.png (774×3 px, 184 KB)