Hoo man has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/67625


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() return
true.

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

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/25/67625/1

diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index fdf3b76..f8969f3 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -1597,7 +1597,10 @@
                }
 
                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: newchange
Gerrit-Change-Id: Ia17c5cfa634919b43affa146df0d1dc0ff06b758
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to