Page MenuHomePhabricator

Create GlobalBlockLocalStatusLookup service
Closed, ResolvedPublic2 Estimated Story Points

Description

A service is needed that allows callers to lookup the local status of a global block either by the associated target or global block ID. This will be done by moving the static methods GlobalBlocking::getLocalWhitelistInfo and GlobalBlocking::getLocalWhitelistInfoByIP into this new service.

Acceptance criteria
  • Create the GlobalBlockLocalStatusLookup service by using copies of GlobalBlocking::getLocalWhitelistInfo and GlobalBlocking::getLocalWhitelistInfoByIP as the sole methods
  • Update the methods to use DI and SQL query builders
  • Replace the usage of wfGetDb (T357644)
  • Fully test this service

QA Results - Local

Event Timeline

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

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

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

Change 1003391 merged by jenkins-bot:

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

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

Suggested QA steps:

  1. Install GlobalBlocking, if required
  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. Load Special:GlobalBlockList and click the local status link for the global block you performed in step 4
  7. Fill out the form to disable the block on the local wiki
  8. Go back to the incognito tab and try to make an edit while logged out. This should succeed.
  9. Load Special:GlobalBlockList and there should be the text local disabled next to the block you performed in step 4
  10. Click on the local status link again and fill out the form on that page to re-enable the global block on the wiki
  11. Load Special:GlobalBlockList and verify that the block performed in step 4 no longer shows as locally disabled.

As with T357443 and T357399 there should be no functionality changes made by this ticket and it's patch, so you may wish to do these steps on a wiki with a version of the code before this patch to verify this.

@Dreamy_Jazz There are no functionality changes made from the current patch compared to an older patch. This will be moved to Done. Thanks for all your work and steps!

Status: ✅PASS
Environment: Local: 1.42.0-alpha (ba6da7d)17:55, 20 February 2024
OS: macOS Sonoma 14.2.1
Browser: Chrome 121, Safari 14.3
Skins. Vector 2022
Device: MBA M2
Emulated Device:: n/a
Test Links:
Special:GlobalBlock
Special:GlobalBlockList

✅AC1: https://phabricator.wikimedia.org/T357506

GlobalBlocking Current- commit 8d46d991a32e2a3c3575112659641c3532c742ac: Wed Feb 21 08:16:51 2024

Steps 1-8Steps 9-11

GlobalBlocking Old- commit bffe54f3cbc809dd36389ea26e9ca05f631b3414: Fri Feb 9 15:16:07 2024

Steps 1-8Steps 9-11

Thanks for the QA testing!