[go: nahoru, domu]

Page MenuHomePhabricator

Fire postEdit hook when performing a rollback
Closed, ResolvedPublic

Description

For the http-client-hints project, CheckUser listens to the postEdit hook to obtain the newly created revision ID, and it sends this information along with user agent client hints to a CheckUser REST endpoint for storage (see https://www.mediawiki.org/wiki/Extension:CheckUser/Client_Hints and https://wikitech.wikimedia.org/wiki/User-agent_client_hints for more information.)

Rollback action does not fire the postEdit hook, and this task proposes that it starts doing so, so that we can receive client hint data alongside rollback edits. (Doing so would also provide more consistency in having JS editing interfaces use a common hook for signaling that they've made an edit, although, see T330831: Make postEdit hook reliably support user interaction for critiques of postEdit and an alternative proposal.)

There is already a resources/src/mediawiki.misc-authed-curate/rollback.js file that we could add to, for implementation.

Event Timeline

Change 953563 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/core@master] rollback: Fire postEdit JavaScript hook on success

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

Change 953563 merged by jenkins-bot:

[mediawiki/core@master] rollback: Fire postEdit JavaScript hook on success

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

Change 954253 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/CheckUser@master] clienthints: Remove support for setting header on action query parameter

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

Esanders renamed this task from Rollback: Fire postEdit hook to Fire postEdit hook when performing a rollback.Sep 1 2023, 12:58 PM

Change 954253 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] clienthints: Remove Accept-CH header on action and load module on POST

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

Suggested QA steps:

  1. Install the CheckUser extension
  2. Open the Chrome browser
  3. While logged in or logged out, create a page
  4. Log into a different account than the one used in step 3 that also has the administrator group (sysop).
  5. Make an edit to the page created in step 3
  6. Open the history page for this page
  7. Click on the "rollback 1 edit" link for the edit made in step 5.
  8. Get the revision ID for the edit performed by clicking the rollback link (this edit should have the Rollback tag).
  9. Inspect the database table cu_useragent_clienthints_map using the following SQL after replacing <rev id> with the revision ID of the rollback gained in step 8:
SELECT * FROM cu_useragent_clienthints_map WHERE uachm_reference_id = <rev id> AND uachm_reference_type = 0;
  1. Ensure rows are returned. If so, then the postEdit hook was called after making the rollback.
dom_walden subscribed.

I tested that the client hints data was sent when rolling back from history, recent changes, diff pages and watchlist.

I also tested on wikidata rolling back changes on a wikidata item and on commons (locally) rolling back a structured data edit.