Page MenuHomePhabricator

Move logic for determining block behaviour to the Block class
Closed, ResolvedPublic

Description

Some of the logic for determining block behaviour should be moved to the block class. This includes:

  • In PasswordReset::isBlocked, to decide whether to ignore a block, which relies on knowing the system block type. We need to be able to detect if a merged block is from multiple ignorable system blocks.
  • In User::trackBlockWithCookie, to decide whether to track the block with a cookie. Blocks are tracked if the target is an IP or an IP range. We need to be able to recover the types of the original blocks from a merged block.

This will be particularly helpful for T206163 (enforcing multiple blocks at once), in which it may be necessary to determine whether any of the several blocks that apply to one IP behave in a particular way.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 21 2019, 2:54 PM

Change 496208 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/core@master] Move logic for checking block behaviour to Block class

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

dmaza added a subscriber: dmaza.Mar 25 2019, 6:38 PM

Change 496208 merged by jenkins-bot:
[mediawiki/core@master] Move logic for checking block behaviour to Block class

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

Change 500685 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/core@master] Set default for Block::appliesToPasswordReset to true

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

Change 500685 merged by jenkins-bot:
[mediawiki/core@master] Set default for Block::appliesToPasswordReset to true

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

dom_walden added a subscriber: dom_walden.

A globally blocked IPs is prevented from resetting passwords (testing on local vm as don't have rights to block globally on beta).

A blocking cookie is set on a user's browser, if their username is block with autoblock set. A blocking cookie is also set on an anonymous user if their IP is blocked.

From the above I can infer that the moved methods are being called. @Tchanders I don't see much else to do.

The internal logic of the methods (now) appears identical to how they were previously based on reviewing the code and the testing above.

Environments:
https://en.wikipedia.beta.wmflabs.org
MediaWiki 1.33.0-alpha (9dfa200) 08:05, 2 April 2019

Local VM
MediaWiki 1.33.0-alpha (9dfa200) 09:05, 2 April 2019

dbarratt closed this task as Resolved.Apr 10 2019, 6:34 PM