Page MenuHomePhabricator

revisiondelete with multiple ids throws "revdelete-modify-missing"
Open, LowPublic

Description

I'm an admin on hrwiki and I recently wrote a script to hide multiple revisions at the same time from the contributions page.

The script is https://hr.wikipedia.org/wiki/Suradnik:Ivi104/Skripte/Sakrivanje-svih-izmjena-suradnika.js (in Croatian).

I'm using action=revisiondelete and multiple revision ids (pipe separated). The API sometimes hides 1 or 2 revisions and returns an error "revdelete-modify-missing" on the others. I don't know why the error happens and there's nothing in the official docs.

Could someone please look into this?
User:Ivi104

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Aklapper changed the task status from Open to Stalled.Oct 6 2020, 1:20 PM

Hi @Ivi104, could you please provide a minimal self-contained testcase as code, what is expected to happen, and what happens instead, and why you think there is a bug in MediaWiki code and not in your custom code? See also https://www.mediawiki.org/wiki/How_to_report_a_bug - thanks a lot! :)

I'm not really sure how to do that, but I'll try:
:hr:Special:Contributions/93.137.7.71
I wish to hide the last two edits of this user (edits 5638722 [page Nikola Kopernik] and 5638723 [page Ražanj (Rogoznica)] ).
The script sends the following params to the API:

action: "revisiondelete"
format: "json"
hide: "content"
ids: "5638722|5638723"
reason: "grafit"
token: "a6c0bdbe65d6b5fddfa977442eae45695f7c7c58+\"
type: "revision"

API responds with:

{
  "revisiondelete": {
    "status": "Success",
    "target": "Nikola Kopernik",
    "items": [
      {
        "status": "Success",
        "id": 5638722,
        "timestamp": "2020-10-02T22:26:34Z",
        "texthidden": "",
        "userid": 0,
        "user": "93.137.7.71",
        "comment": ""
      },
      {
        "status": "Fail",
        "errors": [
          {
            "message": "revdelete-modify-missing",
            "params": [
              5638723
            ],
            "code": "revdelete-modify-missing",
            "type": "error"
          }
        ],
        "warnings": [],
        "id": 5638723
      }
    ]
  }
}

The first edit is hidden, the second one returns an error.
Thanks!

Aklapper changed the task status from Stalled to Open.Oct 6 2020, 3:17 PM

Some more info: the API looks at the first ID, finds the matching page, and assigns the target parameter automatically. It then looks at the second ID, cannot find the second revision ID on the target page history (because the second ID belongs to a different page), and throws an error.

This is not intended behaviour because I never assigned the target parameter.

The API should limit itself to searching revisions of a single page only if the target parameter was set in the initial request. Otherwise, it should allow hiding multiple revisions of multiple pages.

BPirkle moved this task from Inbox to Later on the Platform Team Workboards (Clinic Duty Team) board.