Page MenuHomePhabricator

Create GlobalBlockLookup service
Closed, ResolvedPublic3 Estimated Story Points

Description

A service is needed to allow callers to lookup global blocks stored in the globalblocks table. This service will move methods from the GlobalBlocking static utility class that are related to lookups, and will also modify the methods to use DI and other necessary fixes that perform no change to the functionality of the methods.

The methods being in a service also allow testing, as the existing methods are completely untested and testing them is difficult without dependency injection.

Acceptance criteria
  • Create the GlobalBlockLookup service by using copies of the relevant methods from the GlobalBlocking static utility class
  • Update the methods to use DI and SQL query builders
  • Ensure good test coverage over the new service

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

Change 1003762 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/GlobalBlocking@master] [Very WIP] Create GlobalBlockLooup service

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

Dreamy_Jazz changed the point value for this task from 2 to 3.Feb 19 2024, 3:20 PM
Dreamy_Jazz updated the task description. (Show Details)

Change 1003762 merged by jenkins-bot:

[mediawiki/extensions/GlobalBlocking@master] Create GlobalBlockLookup service

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

Suggested QA steps:

  1. Install GlobalBlocking, if not already installed
  2. Find the IP address you are using to connect to the wiki (you can find this by editing a page while logged out)
  3. Log into an account with the globalblock right
  4. Globally block the IP address found in step 2 with it configured to be targeting anonymous users only
  5. In an incognito tab try to make an edit while logged out and it should prevent you from doing so
  6. Make sure that the error displayed makes sense and indicates that the block is a global block
  7. Repeat step 4 but add /24 to the end of the IP address. Also provide a different reason for the block to help distinguish it.
  8. Repeat step 5 and verify that the block error message details the block from step 4
  9. Go to Special:GlobalBlockList and verify that both blocks appear in the list
  10. Click on local status for the block made in step 4 and use the form to disable the block
  11. Repeat step 5 and verify that the block message includes details about the block you performed in step 7
  12. Go to Special:Contributions for the IP range you blocked in step 7 and verify that a banner is displayed that says This IP address is currently globally blocked
  13. Load Special:Contributions for the single IP address found in step 2 and verify that in the subtitle there are links to modify and remove the global block on the account as shown in the example below. It is expected that there is no banner because this block was locally disabled.

image.png (92×1 px, 29 KB)

As with T357506: Create GlobalBlockLocalStatusLookup service, these changes should produce no functionality change. As such you may want to test using these steps on a older version of the code and verify no changes are seen.

Change 1005621 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/GlobalBlocking@master] [Very WIP] Update GlobalBlockLookup for global account blocks

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

Change 1005621 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/GlobalBlocking@master] [Very WIP] Update GlobalBlockLookup for global account blocks

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

@Dreamy_Jazz I have done all the testing I had planned to do so far. As this is still unmerged, should this task be moved back to Review?

Change 1005621 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/GlobalBlocking@master] [Very WIP] Update GlobalBlockLookup for global account blocks

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

@Dreamy_Jazz I have done all the testing I had planned to do so far. As this is still unmerged, should this task be moved back to Review?

@dom_walden, I had incorrectly tagged this change against this task. QA for the change still in review will be done in T358155.

@Dreamy_Jazz I have done all the testing I had planned to do so far. As this is still unmerged, should this task be moved back to Review?

@dom_walden, I had incorrectly tagged this change against this task. QA for the change still in review will be done in T358155.

Thanks. I think I have finished my testing for this so will move it along.

I was testing mostly that the correct blocks are applied to blocked IPs.