Merge "Clean up Throttle::throttleIdentifier"

This commit is contained in:
jenkins-bot 2021-07-30 01:37:24 +00:00 committed by Gerrit Code Review
commit ca31a12be4
2 changed files with 2 additions and 5 deletions

View file

@ -187,7 +187,7 @@ class Throttle extends Consequence implements ConsequencesDisablerConsequence {
break;
case 'editcount':
// Hack for detecting different single-purpose accounts.
$identifier = $user->isRegistered() ? $this->userEditTracker->getUserEditCount( $user ) : 0;
$identifier = $this->userEditTracker->getUserEditCount( $user ) ?: 0;
break;
case 'site':
$identifier = 1;
@ -203,7 +203,6 @@ class Throttle extends Consequence implements ConsequencesDisablerConsequence {
// @codeCoverageIgnoreEnd
}
// @phan-suppress-next-line PhanTypeMismatchReturnNullable Simplify 'editcount' in 1.37+
return $identifier;
}
}

View file

@ -308,9 +308,7 @@ class LazyVariableComputer {
case 'user-editcount':
/** @var UserIdentity $userIdentity */
$userIdentity = $parameters['user-identity'];
$result = $userIdentity->isRegistered()
? $this->userEditTracker->getUserEditCount( $userIdentity )
: null;
$result = $this->userEditTracker->getUserEditCount( $userIdentity );
break;
case 'user-emailconfirm':
/** @var User $user */