Page MenuHomePhabricator

Remove Core coupling with GlobalBlocking extension
Open, Needs TriagePublic

Description

With the introduction of GetUserBlock hook in rMW7a5508573a3d: Ensure block hooks keep user state consistent with realistic blocks it is now possible to modify or add[1] more blocks to a user. Considering that in User::getGlobalBlock() when a global block is found what gets returns is a SystemBlock, instead of having the extension listen for UserIsBlockedGlobally, it could listen for GetUserBlock and add the SystemBlock with the global-block type to the user.

User::getGlobalBlock() can be deprecated and replaced with User::getBlock().

By doing this we'll be moving forward decoupling core from the GlobalBlocking extension and downsizing the User class since getGlobalBlock and all the related properties can be deprecated and eventually be removed.

I searched for all the uses of getGlobalBlock and I couldn't find any special casing that would make this transition difficult.[2]

[1] https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/includes/block/CompositeBlock.php
[2] https://codesearch.wmflabs.org/search/?q=getGlobalBlock&i=nope&files=&repos=

Event Timeline

dmaza created this task.Fri, Aug 23, 6:17 PM
Restricted Application added subscribers: MGChecker, Aklapper. · View Herald TranscriptFri, Aug 23, 6:17 PM
WDoranWMF added a subscriber: WDoranWMF.

Since anti-harassment is taking this, we're untagging CPT, please retag if there is work/input needed from us.

aezell added a subscriber: aezell.EditedWed, Sep 11, 2:59 PM

@WDoranWMF It's not actually sure that we will take on this work. We wrote this task so that "someone" in the future could do this work. The decoupling initiative seemed a good candidate. We wrote it because we are knee deep in the code at the moment.

Given recent product discussions, it's highly unlikely we'll have time to tackle this. Our approach here was to provide some insight from the trenches for those people and teams engaged in higher level architectural refactoring.

This got moved to our Estimation column a bit too eagerly perhaps.