jenkins-bot has submitted this change and it was merged.
Change subject: ApiLogin: Don't try to add block info if there's no block
......................................................................
ApiLogin: Don't try to add block info if there's no block
Extensions such as CentralAuth can use various hooks to return
USER_BLOCKED or CREATE_BLOCKED despite there being no local block.
Bug: T111082
Change-Id: I3433a35547967852fc30bd56274392a186004a38
---
M includes/api/ApiLogin.php
1 file changed, 8 insertions(+), 8 deletions(-)
Approvals:
Alex Monk: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php
index 8c65310..c66e215 100644
--- a/includes/api/ApiLogin.php
+++ b/includes/api/ApiLogin.php
@@ -145,10 +145,10 @@
case LoginForm::CREATE_BLOCKED:
$result['result'] = 'CreateBlocked';
$result['details'] = 'Your IP address is
blocked from account creation';
- $result = array_merge(
- $result,
- ApiQueryUserInfo::getBlockInfo(
$context->getUser()->getBlock() )
- );
+ $block = $context->getUser()->getBlock();
+ if ( $block ) {
+ $result = array_merge( $result,
ApiQueryUserInfo::getBlockInfo( $block ) );
+ }
break;
case LoginForm::THROTTLED:
@@ -159,10 +159,10 @@
case LoginForm::USER_BLOCKED:
$result['result'] = 'Blocked';
- $result = array_merge(
- $result,
- ApiQueryUserInfo::getBlockInfo(
User::newFromName( $params['name'] )->getBlock() )
- );
+ $block = User::newFromName( $params['name']
)->getBlock();
+ if ( $block ) {
+ $result = array_merge( $result,
ApiQueryUserInfo::getBlockInfo( $block ) );
+ }
break;
case LoginForm::ABORTED:
--
To view, visit https://gerrit.wikimedia.org/r/235460
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3433a35547967852fc30bd56274392a186004a38
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Tpt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits