jenkins-bot has submitted this change and it was merged.

Change subject: Only show notoken as possible API error once
......................................................................


Only show notoken as possible API error once

Currently notoken is being listed as possible
API error twice if it's explicitly set as
required parameter and needsToken() returns
true.

See:
https://www.wikidata.org/w/api.php?action=paraminfo&modules=edit

Change-Id: Ia17c5cfa634919b43affa146df0d1dc0ff06b758
---
M includes/api/ApiBase.php
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Anomie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index fdf3b76..57287d7 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -1597,7 +1597,12 @@
                }
 
                if ( $this->needsToken() ) {
-                       $ret[] = array( 'missingparam', 'token' );
+                       if ( !isset( $params['token'][ApiBase::PARAM_REQUIRED] )
+                               || !$params['token'][ApiBase::PARAM_REQUIRED]
+                       ) {
+                               // Add token as possible missing parameter, if 
not already done
+                               $ret[] = array( 'missingparam', 'token' );
+                       }
                        $ret[] = array( 'sessionfailure' );
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/67625
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia17c5cfa634919b43affa146df0d1dc0ff06b758
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hoo man <h...@online.de>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Hoo man <h...@online.de>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to