User::getUserPage and User::getTalkPage are intended for linking to user pages, so a LinkTarget target should be sufficient. Not returning a full Title object would help with resolving the circular dependency between Title and User.
Description
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T208764 Remove cyclic dependency between Title and User classes | |||
Open | None | T208778 Make User::getUserPage and User::getTalkPage return a LinkTarget |
Event Timeline
These 2 methods are the last dependency from User to Title!
Instead of changing the method return type I propose to simply deprecate them in favor of PageReferenceValue::localReference( NS_USER/NS_USER_TALK, $user->getName() ) - works with UserIdentity too!
Wow, nice!
Instead of changing the method return type I propose to simply deprecate them in favor of PageReferenceValue::localReference( NS_USER/NS_USER_TALK, $user->getName() ) - works with UserIdentity too!
Having a convenience method somewhere would be nice though... Also, proper modeling the concept of a "user page" could be helpful. Maybe introduce a UserPageLookup service? That would make it easy to introduce more elaborate modeling later. This is especially relevant for anonymous users - we may want do add special treatment for them at some point, instead of having "IP user pages" (or, with IP masking, "random string user pages").
Maybe introduce a UserPageLookup service?
I've started something like it in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/673298 but we were never sure we actually wanted it..