Page MenuHomePhabricator

UserIdentityValue should require a Wiki ID to be passed to the constructor.
Open, LowPublic

Description

To avoid unintentional instantiation of UserIdentityValue objects that lack the correct wiki ID, the $wikiId parameter to the constructor should be required.

  • Trigger a deprecation warning when the $wikiId is missing
  • After successful deprecation, require the parameter in the method signature.

Event Timeline

daniel triaged this task as Medium priority.Jan 29 2021, 2:24 PM
daniel created this task.

The vast majority of instantiations occur in tests. I propose making a MockUserTrait, similar to MockAuthorityTrait with a bunch of predefined UserIdentityValue getters - anon, non-anon, local/foreign etc. And then using the trait in all the tests - we need to update them anyway.. Then when we have time/need, we can add a fancy User mocking method into the trait as well, like MockTitleTrait, but hopefully we won't really need that, since we are slowly getting rid of the user soon enough.

The cases where it's instantiated in production code need to figured out on a case by case basis, so let's start with tests. That's where the extensions do it mostly.

Change 665154 had a related patch set uploaded (by Peter.ovchyn; owner: Peter.ovchyn):
[mediawiki/core@master] Make UserIdentityValue require a Wiki ID to be passed to the constructor

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

For the records, that's been merged (if that patch was the reason to move it to "Blocked" on the workboard?).

daniel lowered the priority of this task from Medium to Low.Oct 20 2022, 8:26 AM
Aklapper added a subscriber: Peter.ovchyn.

@Peter.ovchyn: Removing task assignee as this open task has been assigned for more than two years - See the email sent to task assignee on Feburary 22nd, 2023.
Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome! :)
If this task has been resolved in the meantime, or should not be worked on by anybody ("declined"), please update its task status via "Add Action… 🡒 Change Status".
Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator. Thanks!