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

Change subject: Followup for undefined index "bot", add bot param to MergeItems
......................................................................


Followup for undefined index "bot", add bot param to MergeItems

Follow up for Ie0650eb

MergeItems::getAllowedParams (and parent class methods) allow
setting a list of params with a default. "bot" was missing in
MergeItems, which extends ApiWikibase directly. Various other api
classes extend ModifyEntity or others that have "bot" set.

I believe that was the issue and this is a nicer, more consistent
way to fix the issue.

(still odd that the test failure happened only sometimes, though)

Change-Id: I16c8ea57618498bf22e603de1dd54b339d3a8f8a
---
M repo/includes/api/ApiWikibase.php
M repo/includes/api/MergeItems.php
2 files changed, 5 insertions(+), 2 deletions(-)

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



diff --git a/repo/includes/api/ApiWikibase.php 
b/repo/includes/api/ApiWikibase.php
index 10dc42c..81db295 100644
--- a/repo/includes/api/ApiWikibase.php
+++ b/repo/includes/api/ApiWikibase.php
@@ -477,8 +477,7 @@
                $params = $this->extractRequestParams();
                $user = $this->getUser();
 
-               $bot = isset( $params['bot'] ) ? $params['bot'] : false;
-               $flags |= ( $bot && $user->isAllowed( 'bot' ) ) ? 
EDIT_FORCE_BOT : 0;
+               $flags |= ( $user->isAllowed( 'bot' ) && $params['bot'] ) ? 
EDIT_FORCE_BOT : 0;
 
                $baseRevisionId = isset( $params['baserevid'] ) ? intval( 
$params['baserevid'] ) : null;
                $baseRevisionId = $baseRevisionId > 0 ? $baseRevisionId : false;
diff --git a/repo/includes/api/MergeItems.php b/repo/includes/api/MergeItems.php
index af5399e..6e9a588 100644
--- a/repo/includes/api/MergeItems.php
+++ b/repo/includes/api/MergeItems.php
@@ -212,6 +212,7 @@
                                        ApiBase::PARAM_TYPE => 'string',
                                ),
                                'token' => null,
+                               'bot' => false
                        )
                );
        }
@@ -232,6 +233,9 @@
                                        autocomment together with the summary 
is 260 characters. Be aware that everything above that
                                        limit will be cut off."
                                ),
+                               'bot' => array( 'Mark this edit as bot',
+                                       'This URL flag will only be respected 
if the user belongs to the group "bot".'
+                               ),
                        )
                );
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I16c8ea57618498bf22e603de1dd54b339d3a8f8a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: WikidataJenkins <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to