Florianschmidtwelzow has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371947 )

Change subject: Allow other extensions to setup triggers using attributes
......................................................................

Allow other extensions to setup triggers using attributes

Instead of misusing the config section of extension.json to declare
captcha triggers in the ConfirmEdits CaptchaTriggers config variable,
other extensions can now use the CaptchaTriggers attribute for the
exact same thing. E.g., to declare a new trigger, the following
addition to the own extension.json will register the trigger in
ConfirmEdit:

  "CaptchaTriggers": {
    "wikiforum": true
  }

Bug: T152929
Change-Id: I4c5eaf87657f5dc07787480a2f1a56a1db8c714f
---
M includes/ConfirmEditHooks.php
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmEdit 
refs/changes/47/371947/1

diff --git a/includes/ConfirmEditHooks.php b/includes/ConfirmEditHooks.php
index fc8a540..066eebf 100644
--- a/includes/ConfirmEditHooks.php
+++ b/includes/ConfirmEditHooks.php
@@ -83,15 +83,17 @@
                self::getInstance()->onAuthChangeFormFields( $requests, 
$fieldInfo, $formDescriptor, $action );
        }
 
-       /**
-        * Set up $wgWhitelistRead
-        */
        public static function confirmEditSetup() {
                // @codingStandardsIgnoreStart 
MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
                global $wgCaptchaTriggers, $wgAllowConfirmedEmail,
                        $wgWikimediaJenkinsCI, $ceAllowConfirmedEmail;
                // @codingStandardsIgnoreEnd
 
+               $attributeCaptchaTriggers = ExtensionRegistry::getInstance()
+                       ->getAttribute( 'CaptchaTriggers' );
+               if ( is_array( $attributeCaptchaTriggers ) ) {
+                       $wgCaptchaTriggers += $attributeCaptchaTriggers;
+               }
                // There is no need to run (core) tests with enabled 
ConfirmEdit - bug T44145
                if ( isset( $wgWikimediaJenkinsCI ) && $wgWikimediaJenkinsCI 
=== true ) {
                        $wgCaptchaTriggers = array_fill_keys( array_keys( 
$wgCaptchaTriggers ), false );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4c5eaf87657f5dc07787480a2f1a56a1db8c714f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ConfirmEdit
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>

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

Reply via email to