Page MenuHomePhabricator

Create interface for downloading User data
Closed, ResolvedPublic3 Estimated Story PointsFeb 9 2021

Description

Motivation

MediaWiki allows a download of user data via the Userinfo API but this information is not easily surfaced in the user interface. This has led to some mistaken beliefs that Wikipedia does not allow a download of user data.
The goal for this task is to make the userinfo API visible from Special:Preferences.

Acceptance criteria

Mock could look something like -

  • Where to access: the downloadable report will be available in the "Basic Information" section of the "User profile" tab of Preferences. See the mockup below.

This mock is from an older task for doing this which didn't get done at the time: T208889: Create interface for downloading 'User' data

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Niharika triaged this task as Medium priority.Jan 19 2021, 8:19 PM
ARamirez_WMF set the point value for this task to 3.Jan 27 2021, 5:38 PM
ARamirez_WMF changed the subtype of this task from "Task" to "Deadline".

Change 661669 had a related patch set uploaded (by STran; owner: STran):
[mediawiki/core@master] Add "Account data" section to user preferences

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

@Prtksxna would you be the person to ask this? I'm working on the help message for this ticket and the provided text is wikimedia-specific since it uses CentralAuth. I'm using WikimediaMessages to make that specific override but I think then I need a generic help message for generic mediawiki cases. What should that text be? I thought it could be the text in the original mockup but the link appears to be https://www.mediawiki.org/wiki/API:Userinfo, which is already linked to in the main text.

(If I'm understanding correctly, based on what we talked about in estimation, the main link should only link to that page and not to any API output).

Text of download link Download my account data from this project linking to the output of everything https://www.mediawiki.org/wiki/API:Userinfo gives on that project for that user (is this doable?)

@Niharika @Prtksxna What should the precise query be? Should it be something like api.php?action=query&meta=userinfo, which doesn't add any filters?

@Prtksxna would you be the person to ask this? I'm working on the help message for this ticket and the provided text is wikimedia-specific since it uses CentralAuth. I'm using WikimediaMessages to make that specific override but I think then I need a generic help message for generic mediawiki cases. What should that text be? I thought it could be the text in the original mockup but the link appears to be https://www.mediawiki.org/wiki/API:Userinfo, which is already linked to in the main text.

(If I'm understanding correctly, based on what we talked about in estimation, the main link should only link to that page and not to any API output).

Hey @STran! For a generic help message, could we just say "You may visit your Preferences page on other sister projects where you have contributed in order to download your account data from those projects" and omit the link?

Text of download link Download my account data from this project linking to the output of everything https://www.mediawiki.org/wiki/API:Userinfo gives on that project for that user (is this doable?)

@Niharika @Prtksxna What should the precise query be? Should it be something like api.php?action=query&meta=userinfo, which doesn't add any filters?

@Tchanders The query should aim to show all available information. Does this help?

Hey @STran! For a generic help message, could we just say "You may visit your Preferences page on other sister projects where you have contributed in order to download your account data from those projects" and omit the link?

I think this is still not generic enough and do assumes all wikis are in wiki-farm setup. For stock MediaWiki, the message should not make assumption about 'sister' projects elsewhere. In a lot of MediaWiki installations, there's only one wiki, and that's what core interface message should assume by default.

Is it alright to have a link to a mediawiki.org help page in the help text? If so, the help text could be generic like "For more information, see Help:Downloading account data". We could then give more details on single project and wiki-farm setups there.

I guess, it would also be okay to remove the help text entirely. All other settings on that page (except password?) affect just that wiki, so it would be alright if the download button would be just for that wiki too.

Is it alright to have a link to a mediawiki.org help page in the help text? If so, the help text could be generic like "For more information, see Help:Downloading account data". We could then give more details on single project and wiki-farm setups there.

I guess, it would also be okay to remove the help text entirely. All other settings on that page (except password?) affect just that wiki, so it would be alright if the download button would be just for that wiki too.

I like both of these suggestions. Between the two I'd prefer omitting the message entirely and leaving it up to the wiki operator to decide how they want to handle this. @STran @Ammarpad any objections?

Either suggestion looks OK. The problem is in referencing another/sister wiki that might not exist.

@Niharika I may have gotten confused about the ask in this ticket. Should the main link lead to a data dump (ie. api.php?)? Or to the help page (https://www.mediawiki.org/wiki/API:Userinfo)? If it leads to a data dump, doesn't that also make the link wmf-specific?

If it leads to a data dump, doesn't that also make the link wmf-specific?

If it just leads to the results of an API call (example) then it wouldn't be WMF-specific, since the API is just part of MediaWiki core.

@Tchanders is correct - we want to link to the API output. We can omit the help message for non-WMF wikis.

Change 661700 had a related patch set uploaded (by STran; owner: STran):
[mediawiki/extensions/WikimediaMessages@master] Add override for prefs-user-downloaddata-help-message

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

Change 661669 merged by jenkins-bot:
[mediawiki/core@master] Add "Account data" section to user preferences

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

Change 661700 merged by jenkins-bot:
[mediawiki/extensions/WikimediaMessages@master] Add override for prefs-user-downloaddata-help-message

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

@Niharika @Prtksxna What should the precise query be? Should it be something like api.php?action=query&meta=userinfo, which doesn't add any filters?

@Tchanders The query should aim to show all available information. Does this help?

For me, api.php?action=query&meta=userinfo only returns username and ID (e.g. https://en.wikipedia.org/w/api.php?action=query&meta=userinfo).

I think we have to explicitly choose which properties we want to return (via the uiprop param).

@Niharika @Prtksxna What should the precise query be? Should it be something like api.php?action=query&meta=userinfo, which doesn't add any filters?

@Tchanders The query should aim to show all available information. Does this help?

For me, api.php?action=query&meta=userinfo only returns username and ID (e.g. https://en.wikipedia.org/w/api.php?action=query&meta=userinfo).

I think we have to explicitly choose which properties we want to return (via the uiprop param).

This is correct. We need to return all information we have on the user.

Change 664638 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/core@master] Pass linkable user name in Special:Preferences "Account data" help text

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

Change 664638 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/core@master] Pass linkable user name in Special:Preferences "Account data" help text

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

This is to fix a bug found by @Jdforrester-WMF, where user names with spaces don't link properly. E.g. for User Admin (bdi), the help text shows up as:

...and links to https://meta.wikimedia.org/wiki/Special:CentralAuth?target=Admin

Change 664638 merged by jenkins-bot:
[mediawiki/core@master] Pass linkable user name in Special:Preferences "Account data" help text

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

This is correct. We need to return all information we have on the user.

@Tchanders @STran Just pinging in case this got forgotten. I think from the meeting we were going to explicitly include all the uiprop's.

Thanks for the reminder @dom_walden - taking a look

Change 665159 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/core@master] Add all userinfo properties to user data link in user preferences

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

Change 665159 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/core@master] Add all userinfo properties to user data link in user preferences

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

This commit adds the uiprops

Change 665159 merged by jenkins-bot:
[mediawiki/core@master] Add all userinfo properties to user data link in user preferences

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

@STran @Tchanders What is the expectation with regards to support for usernames with non-alphanumeric characters?

Examples from my local environment:

These are extreme examples I grant, but apparently legit (i.e. not blocked) usernames with these characters do exist in the wild (e.g. https://en.wikipedia.org/wiki/Special:ListUsers?username=%2B+%2B&group=&wpsubmit=&wpFormIdentifier=mw-listusers-form&limit=500, https://en.wikipedia.org/wiki/Special:ListUsers?username=%22+...Nella+sua+meravigliosa+Luce+%22&group=&wpsubmit=&wpFormIdentifier=mw-listusers-form&limit=500).

Happy to raise a separate bug.

Happy to raise a separate bug.

Raised T275620.

The url to download a user's data is now: w/api.php?action=query&meta=userinfo&uiprop=*. This returns all the properties available for API:Userinfo. I verified this by comparing this to an API request in which I explicitly listed all the properties.

Test environment: https://en.wikipedia.beta.wmflabs.org MediaWiki 1.36.0-alpha (5bedaf1) 14:19, 23 February 2021.

Tchanders added a subscriber: matmarex.

@Prtksxna, @Niharika This design tweak has been suggested by @matmarex:

It makes sense to me, but wanted to run by you.

Change 668477 had a related patch set uploaded (by Tchanders; owner: Bartosz Dziewoński):
[mediawiki/core@master] preferences: Use OOUI button for the "Download my account data" link

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

My reasoning is that buttons should be used for actions (verbs), while links should be reserved for viewable things (nouns).

If you wanted to make this less prominent and keep it as a link, then I'd suggest changing the label from "Download my account data" to just "My account data".

My reasoning is that buttons should be used for actions (verbs), while links should be reserved for viewable things (nouns).

Yep, you’re right.

If you wanted to make this less prominent and keep it as a link, then I'd suggest changing the label from "Download my account data" to just "My account data".

I think this would be the way to go. It isn’t something that people do commonly and it is right on top of settings, so having it be a link is better. I’ve created a ticked for this here T276658: Download user data: Change label text for link

This sounds fine to me! Let's make these changes in T276658: Download user data: Change label text for link - thanks @Prtksxna.

Oops, just noticed Thalia already has a patch. :)

Change 668477 abandoned by Tchanders:
[mediawiki/core@master] preferences: Use OOUI button for the "Download my account data" link

Reason:
Going with I69253a999a1 as per T272412#6888793

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

Please let me know if I should create a seperate task... But any thoughts about backporting this to MW-1.35-release ?

I know we don't usually backport features, but as this is for data portability type purposes, this feels like the sort of thing that should potentially be backported. And it's only a handful of small commits to do it

Change 670594 had a related patch set uploaded (by Reedy; owner: STran):
[mediawiki/core@REL1_35] Add "Account data" section to user preferences

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

Change 670595 had a related patch set uploaded (by Reedy; owner: Tchanders):
[mediawiki/core@REL1_35] Pass linkable user name in Special:Preferences "Account data" help text

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

Change 670596 had a related patch set uploaded (by Reedy; owner: Tchanders):
[mediawiki/core@REL1_35] Add all userinfo properties to user data link in user preferences

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

Change 670594 merged by jenkins-bot:
[mediawiki/core@REL1_35] Add "Account data" section to user preferences

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

Change 670595 merged by jenkins-bot:
[mediawiki/core@REL1_35] Pass linkable user name in Special:Preferences "Account data" help text

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

Change 670596 merged by jenkins-bot:
[mediawiki/core@REL1_35] Add all userinfo properties to user data link in user preferences

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