Page MenuHomePhabricator

Add timestamp to action=compare
Closed, ResolvedPublicFeature

Description

As far as I can tell action=compare doesn't support a timestamp prop, which, at least to me, it seems like it should (returning fromtime and totime or the like).

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 changed the subtype of this task from "Task" to "Feature Request".Mar 15 2020, 12:58 AM
DannyS712 moved this task from Unsorted to Needs details or plan on the MediaWiki-API board.
Anomie added a project: good first task.
Anomie added a subscriber: Anomie.

Seems straightforward enough. I'd recommend naming them fromtimestamp and totimestamp though.

To complete this task, most of the changes would be to ApiComparePages.php:

  • Add 'timestamp' as an option in the array at lines 717–727.
  • Add code to setVals() similar to that at lines 588–590 to put the timestamp in the result when requested.
    • You'd use $rev->getTimestamp() to fetch the timestamp from the revision, and use wfTimestamp() to convert it to TS_ISO_8601 format. You may also need to handle the case where $rev->getTimestamp() returns null, likely to avoid setting the response property at all.
  • Add appropriate tests to ApiComparePagesTest.php.

I would like to work on this issue and am I supposed to leave the timestamps empty in case $rev->getTimestamp() returns null.

Change 587316 had a related patch set uploaded (by Vd; owner: Vd):
[mediawiki/core@master] Added timestamp to action=compare \n\nAdded timestamp props to ApiComparePages.php with value setting only occuring when getTimestamp() does not return null. Added appropriate tests to ApiComparePagesTest.php. \n\nFeature: T247686

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

Change 587584 had a related patch set uploaded (by Vd; owner: Vd):
[mediawiki/core@master] Added timestamp to action=compare

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

Change 587316 had a related patch set uploaded (by Vd; owner: Vd):
[mediawiki/core@master] Added timestamp to action=compare

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

Change 587584 abandoned by Vd:
Added timestamp to action=compare

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

Change 587316 merged by jenkins-bot:
[mediawiki/core@master] Added timestamp to action=compare

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

Aklapper removed a project: Patch-For-Review.

@Vdas09: Congratulations, your patch in Gerrit has been merged! Hence I assume that this task can be resolved (via Add Action...Change Status.