Page MenuHomePhabricator

Moderator gets user contributions
Closed, ResolvedPublic

Description

Story
"As a Moderator, I want to get a list of revisions of pages a user has created or updated, to judge the user’s intentions and ability."

A rough equivalent of the user contributions page in REST form. Compare T252202, which gets the contributions for the current user.

Designs/Interface/Mockups

GET /user/{name}/contributions?{older_than|newer_than={id}}

Segmented contribution history by user with name name. (I'm calling it "segmented" instead of "paged" so we don't all go crazy.)

{name} is the user name.
If older_than is provided, only show the newest revisions strictly older than the given revision ID, non-inclusive.
If newer_than is provided, only show the oldest revisions strictly newer than the given revision ID, non-inclusive.
Only one of older_than or newer_than are allowed.

Request body: none

Notable request headers: none

Status:
200 - OK
404 – no such user

Notable response headers: none

Body: JSON, an object with the following fields:
older: full link to API endpoint for the next older segment of results (usually the same endpoint plus "older_than" with the last revision in this segment). May be excluded if there are no known older revisions.
newer: full link to API endpoint for the next newer segment of results (usually the same endpoint plus "newer_than" parameter for first revision in this segment). May be excluded if there are no known older revisions.
latest: full link to API endpoint for the latest values, usually just this endpoint with no parameters
revisions: an array of 0 to 20 revision objects, in reverse chronological order, each with the following information:
id: revision id
comment: edit summary of the change, provided by the user
timestamp: date of change, YYYY-MM-DDTHH:MM:SSZ
delta: +/- count of bytes changed from previous
size: count of bytes
page: Page that was modified, JSON object with the following properties: {id, key, title} (see schema for details)
tags: array of Tag objects (see schema)

Done Criteria

  • Returns a list of page revisions created by a given contributor
  • Returns a list of page revisions updated by a given contributor
  • Returns a list of page revisions created for the current logged-in user
  • Returns a list of page revisions updated for the current logged-in user
  • Returns a list of page revisions created or updated by a given contributor older than, but not including, a given revision ID
  • Returns a list of page revisions created or updated by a given contributor newer than, but not including, a given revision ID
  • Only one of older_than or newer_than are permitted
  • Returned list must segmented based on a LIMIT
  • Response object must be JSON
  • Response object must contain the following fields:
    • older: full link to API endpoint for the next older segment of results (usually the same endpoint plus "older_than" with the last revision in this segment). May be excluded if there are no known older revisions.
    • newer: full link to API endpoint for the next newer segment of results (usually the same endpoint plus "newer_than" parameter for first - revision in this segment). May be excluded if there are no known older revisions.
    • latest: full link to API endpoint for the latest values, usually just this endpoint with no parameters
    • revisions: an array of 0 to 20 revision objects, each with the following information:
    • id: revision id
    • comment: edit summary of the change, provided by the user
    • timestamp: date of change, YYYY-MM-DDTHH:MM:SSZ
    • delta: +/- count of bytes changed from previous
    • size: count of bytes
    • page: Page that was modified, JSON object with the following properties: {id, key, title} (see the schema for details)

Related Stories

"As a Reader, I want to get a list of revisions of pages a Contributor has created or updated, because I want to read more of what they have written."

"As a Contributor, I want to get a list of revisions of pages another Contributor has created or updated, because I want to contribute to pages that are similar to ones that I've collaborated on with that person."

"As a Curator, I want to get a list of revisions of pages a Contributor has created or updated, because they may have made a repeated mistake on multiple pages."

Event Timeline

eprodromou renamed this task from Administrator gets user contributions to Moderator gets user contributions.Nov 10 2019, 4:31 PM
eprodromou updated the task description. (Show Details)
eprodromou updated the task description. (Show Details)Mar 26 2020, 1:19 PM
Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptMar 26 2020, 1:19 PM
eprodromou updated the task description. (Show Details)Mar 26 2020, 1:20 PM
WDoranWMF updated the task description. (Show Details)May 7 2020, 3:12 PM
WDoranWMF updated the task description. (Show Details)May 7 2020, 3:15 PM
eprodromou updated the task description. (Show Details)May 7 2020, 5:57 PM
eprodromou updated the task description. (Show Details)

There are a few things that I want to call out here:

  • File uploads are dealt with as revisions to the description page for the file in our user interfaces (both the page history and the user contributions page). I feel like there's a significant amount of information that might be useful to learn about file uploads; I'd like to consider expanding the PageRevision class in the schema to include a FileRepresentation for file uploads, perhaps.
eprodromou updated the task description. (Show Details)May 7 2020, 6:25 PM
WDoranWMF updated the task description. (Show Details)May 7 2020, 6:42 PM
eprodromou updated the task description. (Show Details)May 8 2020, 1:54 PM
eprodromou updated the task description. (Show Details)May 11 2020, 3:34 PM
eprodromou updated the task description. (Show Details)May 13 2020, 5:30 PM

Change 605914 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] WIP: REST /user/{name}/contribs

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

Change 605914 merged by jenkins-bot:
[mediawiki/core@master] REST /user/{name}/contribs

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

daniel added a subscriber: daniel.

Patch is merged. Note that the implementation follows the adjustments we made to T252202, so the description on this task is obsolete. In particular, we use a single segment parameter rather than using older_than and newer_than.

I've reviewed this endpoint; as far as I can tell, the tags element only includes the text of the tag, and not the URL. I believe that that is unique info that's useful for contributors. Can you give me an update?

I've reviewed this endpoint; as far as I can tell, the tags element only includes the text of the tag, and not the URL. I believe that that is unique info that's useful for contributors. Can you give me an update?

You are right, we are currently only returning the tag name, not a Tag structure. That is easy to fix, but I don't know what the URL should point to. The schema just says "URL for the tag", what does that mean?

eprodromou added a comment.EditedJul 27 2020, 11:43 AM

So, if I go to recent changes, many (but not all) of the tags are linked. For example, "AWB" goes to https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser.

Looking at the code for ChangeTags:formatSummaryRow, it looks like this isn't stored as an URL, but as wikitext at https://en.wikipedia.org/wiki/MediaWiki:Tag-AWB, labelled appearance.

It would be nice to have the actual URL available for client developers, but since that's kind of hard to do with this structure, let's replace url with appearance and appearance_source, being the HTML and wikitext versions of the appearance.

@eprodromou Do you have any objection to me renaming the 'name' path param to 'user'? It makes more sense with how the backend is refactored now, but from an end user perspective I think it also makes more sense for the case of passing in an ip address, as thats more of a 'user' than a name.

No problem, I don't think the param names are visible to the end user anyway.

I'm moving this back to Ready, since the tags are still strings.

I've moved the requirement to add appearance and appearance_source to a separate ticket T259716. So we really just need to have the tags as a structure rather than a string, so that it's future-compatible when we add more properties.

Change 618640 had a related patch set uploaded (by Nikki Nikkhoui; owner: Nikki Nikkhoui):
[mediawiki/core@master] Make array of tags with property 'text'

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

Change 618640 merged by jenkins-bot:
[mediawiki/core@master] Make array of tags with property 'text'

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

@eprodromou To validate the fact that contributions included in the endpoints are only mediawiki revisions, I made some edits to beta as an anon user.

You can see the Special:contributions page (which should have all contributions) shows 2 contributions. (One revision, one Flow comment) https://en.wikipedia.beta.wmflabs.org/w/index.php?target=73.97.138.87&namespace=all&tagfilter=&start=&end=&title=Special%3AContributions

The endpoint itself returns 1 contribution (just the mediawiki revision)
https://en.wikipedia.beta.wmflabs.org/w/rest.php/coredev/v0/user/73.97.138.87/contributions

To test the /me endpoint you can make an edit to this page that has Flow enabled: https://en.wikipedia.beta.wmflabs.org/wiki/EnableFlow_2015-08-08

Docs for this endpoint have been reviewed and are ready to be published when this endpoint goes into v1.

eprodromou closed this task as Resolved.Wed, Sep 16, 2:59 PM