The new EmailUser class encapsulates logic for email-related permission
checks, so this doesn't have to be in User anymore. The two methods are
roughly equivalent, but EmailUser performs the following additional
checks:
- User::isBlockedFromEmailuser
- Ratelimiter
- onEmailUserPermissionsErrors hook
Also deprecate the EmailUserPermissionsErrors hook: after this change,
it becomes equivalent to the UserCanSendEmail hook. The only difference
is that the former also takes an $editToken parameter, but it's unused.
The hook was added in 2009 in
372ee7b344%5E%21
with TorBlock as the intended consumer. At the time, the
getPermissionsError was using the $editToken parameter, so I guess it
felt natural to pass it to the hook as well; however, the hook in
TorBlock never needed it. The method no longer needs the token as of
38c7c8f895%5E%21/#F3
in 2010, but it was never removed from the hook. Also, it's unclear why
an internal detail such as the edit token should be exposed like this.
Note that the UserCanSendEmail hook is also going to be replaced
eventually, but that'll happen in a separate patch.
Bug: T265541
Change-Id: I2492b261505886d845260e2b63c5e71966a637ce