Page MenuHomePhabricator

Replace AutopromoteCondition hook with a more general one, which supports non-performer users and remote users
Closed, ResolvedPublic

Description

Currently, the AutopromoteCondition hook assumes that we're testing a user, which is potentially going to be autopromoted. The main consequences of this are: the tested user must be from the local wiki and the tested user is assumed to be performing the current request. These assumptions will no longer be true in general, after extending the scope of UserRequirementsConditionChecker.

Therefore, a new hook will need to be created, which will eventually replace the old one.

Acceptance criteria

  • UserRequirementsCondition hook is created with signature (string|int $type, array $args, UserIdentity $user, bool $isPerformingRequest, bool &$result)
  • UserRequirementsConditionChecker::checkCondition fires the new hook regardless of whether the user is local or remote, regardless of it being the request performer or not.
  • AutopromoteCondition hook is deprecated but still called – provided that the user is from local wiki and is the request performer.

Details

Related Changes in Gerrit:

Event Timeline

mszwarc changed the task status from Open to In Progress.Oct 24 2025, 11:16 AM
mszwarc claimed this task.

Change #1198525 had a related patch set uploaded (by Mszwarc; author: Mszwarc):

[mediawiki/core@master] Introduce UserRequirementsCondition hook

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

Change #1198525 merged by jenkins-bot:

[mediawiki/core@master] Introduce UserRequirementsCondition hook

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