Background
Blocks can be reported to the user via several different block error messages. BlockErrorFormatter::getBlockErrorMessageKey chooses which message to use, depending on the type of block.
After T317201: Allow extensions to modify block error message key via a hook, extensions can tell BlockErrorFormatter which error message key to use. GlobalBlocking should have a handler for this hook that uses one of the extension's block messages.
Acceptance criteria
- If there is a GlobalBlock and no other block, the error message displayed is one of 'globalblocking-ipblocked', 'globalblocking-ipblocked-range' or 'globalblocking-ipblocked-xff'
If there is a CompositeBlock that includes a GlobalBock, the block reason is updated to include details of the global block(see end of T317308#8276750)- The hooks onGlobalBlockingBlockedIpMsg, onGlobalBlockingBlockedIpRangeMsg and onGlobalBlockingBlockedIpXffMsg are run so that WikimediaMessages can alter the message keys
- If there is no global block, nothing is changed
Notes
See GlobalBlocking::getUserBlockDetails for how the message keys are currently chosen
Testing notes
This task affects anywhere that throws a UserBlockedError with a global block. One example in core is SpecialUpload.
Before testing:
- This should be tested with and without the WikimediaMessages extension. (This might mean it needs to be tested locally?)
- This needs to be tested with T317201. (That patch has been merged, but if testing locally core may need updating.)
- Where testing with WikimediaMessages, this should be tested with T321574: Override new GlobalBlocking messages on WikimediaMessages
Steps to test (without WikimediaMessages):
- Globally block your IP address. (Make sure there are no local blocks or other local blocks against your IP address.)
- Log out and visit Special:Upload
- Before this change, the message to tell you you are blocked is blockedtext
- After this change, the blocked message should be globalblocking-blockedtext-ip
Repeat this, but in the first 2 steps:
- block an IP range covering your IP address. The new message should be globalblocking-blockedtext-range.
- change your XFF header using a browser extension such as [[ chrome://extensions/?id=hkghghbnihliadkabmlcmcgmffllglin | this one ]], and block that IP address. The new message should be globalblocking-blockedtext-xff.
Repeat all of the above with WikimediaMessages enabled. The messages should be as above, prefixed with wikimedia-.