Page MenuHomePhabricator

Remove Core coupling with GlobalBlocking extension
Closed, ResolvedPublic

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=

Related Objects

StatusSubtypeAssignedTask
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedCyndymediawiksim
ResolvedCyndymediawiksim
ResolvedCyndymediawiksim
Resolved AGueyte
Resolved TThoabala
ResolvedDreamy_Jazz
Resolved AGueyte
ResolvedWMDE-Fisch
Resolved AGueyte
ResolvedCyndymediawiksim
ResolvedCyndymediawiksim
ResolvedUniversal_Omega
ResolvedTchanders
ResolvedTchanders
Resolved AGueyte
ResolvedSTran
Resolvedmatmarex
ResolvedDreamy_Jazz

Event Timeline

WDoranWMF subscribed.

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

@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.

@WDoranWMF Anti-Harassment will not be taking on this ticket. Feel free to prioritise per CPT plans.

Tchanders subscribed.

Adding Anti-Harassment-Team back, since we did end up taking this work, and should do T319069: Remove global-blocks-specific methods and hook from User class when the stable interface policy allows.

Dreamy_Jazz claimed this task.
Dreamy_Jazz subscribed.

T401594: Remove the UserIsBlockedGlobally hook dropped the methods from the User class. T401594: Remove the UserIsBlockedGlobally hook will handle removing the associated hook, but given that hook is no longer run I think we can call the overall goal of this task done