Page MenuHomePhabricator

Use BlockUser service in SpecialInvestigateBlock
Closed, ResolvedPublic2 Estimated Story PointsOct 20 2020


Following T189073: Refactor logic for creating and logging a block out of SpecialBlock so it can be easily reused elsewhere, we should update SpecialInvestigateBlock to use the new BlockUser service, instead of the deprecated method SpecialBlock::processForm.

As well as improving the architecture, this will fix an error I encountered locally (unlikely in real life), when a user tries to block themselves - filed as T257918:

ErrorException from line 789 of /var/www/html/mediawiki/core/includes/specials/SpecialBlock.php PHP Notice: Undefined index: PreviousTarget

This is due to SpecialBlock::processForm not expecting to be called from external forms that don't necessarily have the same fields as SpecialBlock.

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptOct 1 2020, 12:24 PM
Niharika triaged this task as Medium priority.Oct 6 2020, 4:14 PM
Niharika set the point value for this task to 2.

Change 632906 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/extensions/CheckUser@master] SpecialInvestigateBlock: Remove dependency on SpecialBlock

ARamirez_WMF changed the subtype of this task from "Task" to "Deadline".

Change 632906 merged by jenkins-bot:
[mediawiki/extensions/CheckUser@master] SpecialInvestigateBlock: Remove dependency on SpecialBlock

dom_walden added a subscriber: dom_walden.

I used Special:InvestigateBlock to block various users, IPs and ranges, including reblocking users.

I checked that the blocks were created with the correct parameters by looking in the database.

I checked that there were no errors in the logs.

I also tested with $wgBlockAllowsUTEdit = false and with the blockemail right removed from the admin. The checkbox to block user from own User_talk and email (resp.) are removed. Otherwise, form submits fine and block is made.

Test Environment: Local vagrant MediaWiki 1.36.0-alpha (8e68310).