While trying to modify Minerva for IP masking I ran into this error.
The UserIdentity interface has isRegistered but no isTemp method. Was this intentional? If so, how do you advise we check temporary state from a UserIdentity object?
While trying to modify Minerva for IP masking I ran into this error.
The UserIdentity interface has isRegistered but no isTemp method. Was this intentional? If so, how do you advise we check temporary state from a UserIdentity object?
For context I ran into this issue here: https://gerrit.wikimedia.org/r/c/mediawiki/skins/MinervaNeue/+/886192
The UserIdentity interface has isRegistered but no isTemp method. Was this intentional?
I suspect it's to keep UserIdentity free from service dependencies, as a simple value object. @tstarling or @daniel could confirm.
If so, how do you advise we check temporary state from a UserIdentity object?
We have been injecting UserNameUtils and using $this->userNameUtils->isTemp( $user->getName() ).
Yes, that's correct.
The reason that it has an isregistered() method is that it's synonymous with "has a user ID".
If so, how do you advise we check temporary state from a UserIdentity object?
We have been injecting UserNameUtils and using $this->userNameUtils->isTemp( $user->getName() ).
That's the correct approach, yes.
The alternative would eb to inject the knowledge into the constructor of UserIdentityValue. But it's a newable object, so the cosntructor signature is considered stable.
@Jdlrobson There's a discussion about adding a user_is_temp column to the user table on T333223. If this goes ahead, I suppose the would be an isTemp method on UserIdentity.
I disagree. If we follow the pattern we also use for pages and revisions, UserIdentity represents *just* the identity, not information about the user. We would introduce a UserRecord or AccountRecord that represents information about the user.
The problem with adding information to the "identity" object is that it then becomes non-newable. But we want it to be possible to construct these objects directly, because you should be able to look up information about a user by supplying a UserIdentity.