The ::getIPBlock() method returns all current blocks affecting the IP
address.
Supporting changes:
* Extract ::getXffBlocks() from ::getAdditionalIpBlocks() and rename the
latter to ::getSystemIpBlocks()
* Add ::getIpBlock(), which returns an AbstractBlock instance that
represents all blocks affecting the IP, including range blocks and
system blocks (using ::getSystemIpBlocks())
Additional changes:
* Update DocBlocks for all methods mentioned above
Bug: T270318
Change-Id: I2009c3a7143c10167461e1ce9d4b8efe81390ff6
Will make it easier to migrate away from using Message and use
MessageValue/TextFormatter if only a single type of formatting
is used - other messages in the class use plain() instead of text()
Change-Id: If2a7f5aa7aebedb2965ca6d3aa2b83d1b979bd37
This seems to be a regression from 166ed5c.
DatabaseBlock::newFromTarget may return an autoblock for an IP
unless there is an existing manual block. If so, ignore it
because it is allowed to have an IP address both manually
blocked and autoblocked (see ipb_address_unique index).
Also add an integration test case.
Bug: T287798
Change-Id: I7c9a66ba0ffe759f43f4d0821c30fb94649d3dea
Current code fetches a User based on their id, and then retrieves
a Title object for that User's user page via User::getUserPage().
That Title object is then used to retrieve the text and prefixed text.
Instead, retrieve the UserIdentity from the block directly,
and then create the PageReference manually. Use TitleFormatter to retrieve
the text and prefixed text.
Change-Id: Ic44bfb882523595566031a0fd788be4f15ef19e9
Previously, BlockUser::placeBlockInternal attempted to insert
the new block with possible failure due to an existing block.
Regardless of the result, it would then retrieve the current
block which could be the just now inserted block. This one
was treated as the prior block and incorrectly provided to
the hook as such.
Refactor the method a little by retrieving the prior block
before attempting to insert a new one to make it more
efficient and to ensure the hook will have the correct value
for the prior block.
Change-Id: I70480ce32545f28f8317bb58f9c724d64cc54ccf
Expose info about user blocks from Authority. This allows calling code
to provide more detailed information to the user about why they are
denied some action on the wiki.
Bug: T271494
Change-Id: Ia84e469888866d72752aad355292666c31e12bad
Replace all uses of AbstractBlock::getTarget with
Block ::getTargetName and ::getTargetUserIdentity.
Create AbstractBlockTest and two test cases for
AbstractBlock::getTarget and ::getTargetAndType.
It tests triggering of the deprecation warning.
Bug: T282247
Depends-On: I0543f363af66c57f5763b91320d87a69f23f9466
Change-Id: Iaeca824cac30172178de72f3cf7b7ae4cdd6f880
Implementation in UserBlockCommandFactory only needs
a UserIdentity, no need to document a full User object
Change-Id: I39dcb48bff9f5de8ff964f7ed8f9f2c7da4e4046
This used to be needed when we couldn't pass a cross-wiki
user target correctly. Now that UserIdentity is cross-wiki-aware,
we can.
Bug: T283642
Depends-On: I6f57357d3a73e753e018986e6af6245c29468875
Depends-On: Ie48ee3fcbf3fa7a285e80caf627be0b726b757c2
Change-Id: I3c21e55022c5fb316a390027f7c28211b29c3d62
This is an attempt to avoid confusion about which wiki database a given
Block belongs to.
Eventually, Block and DatabaseBlockStore should become fully cross-wiki
aware.
Change-Id: I93a8e953e2c7b21ea14b1119820cdaccea1060fc
In order to allow Authority to know about user blocks,
we need a narrow interface to represent such blocks.
This deprecates some methods on AbstractBlocks in favor
of new methods on the Block interface that avoid binding to
the User class.
Bug: T271494
Change-Id: I7bb950533970984a014de0434518fbbefb695131
This is no longer needed in Wikimedia production. Third
party users will have had a release to adjust to one of
the three called-out migration issues. It's time.
Bug: T277987
Change-Id: Ia4a797afc71441ed9a7a90ff4f1e72cc4495cf63
Duplicate action codes (eg. extensions assign colliding action ids)
will caused unexpected partial blocking behavior. This lets someone
know that there's a duplicate by throwing before that happens.
Bug: T281915
Change-Id: I34cab4360d40805a9259cf6f2b4cbf05cee6184c
DatabaseBlockStore is capable of inserting cross-wiki
DatabaseBlock, which works via passing non-local IDatabase.
Ideally, we'd want to make Block a WikiAwareEntity, have
cross-wiki DatabaseBlockStore, etc. But as a quick-fix for
a regression we can just fetch correct ActorNormalization
Bug: T281972
Change-Id: I796f54b7b7303b8c442d5b9ba1926b76d3805fb5