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

Change subject: Add user_mobile AbuseFilter variable, to allow debugging mobile 
edits.
......................................................................


Add user_mobile AbuseFilter variable, to allow debugging mobile edits.

Change-Id: I30276fc8d9ed7869dd8d21eddc054497e88a9b9a
---
M MobileFrontend.i18n.php
M MobileFrontend.php
M includes/MobileFrontend.hooks.php
3 files changed, 38 insertions(+), 0 deletions(-)

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



diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php
index 5a1401f..2d5dbb7 100644
--- a/MobileFrontend.i18n.php
+++ b/MobileFrontend.i18n.php
@@ -293,6 +293,9 @@
        'mobile-frontend-talk-reply-success' => 'Your reply was successfully 
saved to the talk page.',
        'mobile-frontend-talk-reply-info' => 'Note your reply will be 
automatically signed with your username.',
        'mobile-frontend-talk-reply' => 'Reply',
+
+       // AbuseFilter variable
+       'abusefilter-edit-builder-vars-user-mobile' => 'Whether or not a user 
is editing through the mobile interface',
 );
 
 /** Message documentation (Message documentation)
@@ -771,6 +774,7 @@
        'mobile-frontend-talk-reply-info' => 'Inform the user their talk reply 
will be automatically signed.',
        'mobile-frontend-talk-reply' => 'Reply heading.
 {{Identical|Reply}}',
+       'abusefilter-edit-builder-vars-user-mobile' => 'See 
abusefilter-edit-builder-vars-user-name (from AbuseFilter extension), for 
example.',
 );
 
 /** Achinese (Acèh)
diff --git a/MobileFrontend.php b/MobileFrontend.php
index 9b04eae..ecb4e97 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -105,6 +105,8 @@
 $wgHooks['SpecialPage_initList'][] = 
'MobileFrontendHooks::onSpecialPage_initList';
 $wgHooks['ListDefinedTags'][] = 'MobileFrontendHooks::onListDefinedTags';
 $wgHooks['RecentChange_save'][] = 'MobileFrontendHooks::onRecentChange_save';
+$wgHooks['AbuseFilter-generateUserVars'][] = 
'MobileFrontendHooks::onAbuseFilterGenerateUserVars';
+$wgHooks['AbuseFilter-builder'][] = 
'MobileFrontendHooks::onAbuseFilterBuilder';
 $wgHooks['SpecialPageBeforeExecute'][] = 
'MobileFrontendHooks::onSpecialPageBeforeExecute';
 $wgHooks['UserLoginComplete'][] = 'MobileFrontendHooks::onUserLoginComplete';
 $wgHooks['UserLoginForm'][] = 'MobileFrontendHooks::onUserLoginForm';
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 0a61777..162793a 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -309,6 +309,38 @@
        }
 
        /**
+        * AbuseFilter-getUserVars hook handler that adds a user_mobile 
variable.
+        *
+        * @param $vars AbuseFilterVariableHolder object to add vars to
+        * @param $user User object
+        * @return true
+        */
+       public static function onAbuseFilterGenerateUserVars( $vars, $user ) {
+               $context = MobileContext::singleton();
+
+               if ( $context->shouldDisplayMobileView() ) {
+                       $vars->setVar( 'user_mobile', true );
+               } else {
+                       $vars->setVar( 'user_mobile', false );
+               }
+
+               return true;
+       }
+
+       /**
+        * AbuseFilter-builder hook handler that adds user_mobile variable to 
list
+        *  of valid vars
+        *
+        * @param &$builder array Array in AbuseFilter::getBuilderValues to add 
to.
+        * @return true
+        */
+       public static function onAbuseFilterBuilder( &$builder ) {
+               $builder['vars']['user_mobile'] = 'user-mobile';
+               return true;
+       }
+
+
+       /**
         * Invocation of hook SpecialPageBeforeExecute
         *
         * We use this hook to ensure that login/account creation pages

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I30276fc8d9ed7869dd8d21eddc054497e88a9b9a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Werdna <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to