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

Change subject: Support Commons app and uploads
......................................................................


Support Commons app and uploads

Change-Id: I06ead8fb975b1586551e8f38af8e0b8f10f65532
---
M MobileApp.hooks.php
1 file changed, 14 insertions(+), 10 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  Niedzielski: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/MobileApp.hooks.php b/MobileApp.hooks.php
index 586dd37..205650a 100644
--- a/MobileApp.hooks.php
+++ b/MobileApp.hooks.php
@@ -24,16 +24,20 @@
        public static function onRecentChange_save( RecentChange $rc ) {
                global $wgRequest;
                $userAgent = $wgRequest->getHeader( "User-agent" );
-               if ( strpos( $userAgent, "WikipediaApp/" ) === 0 ) {
-                       // This is from the app!
-                       $logType = $rc->getAttribute( 'rc_log_type' );
-                       // Only apply tag for edits, nothing else
-                       if ( is_null( $logType ) ) {
-                               $rcId = $rc->getAttribute( 'rc_id' );
-                               $revId = $rc->getAttribute( 'rc_this_oldid' );
-                               $logId = $rc->getAttribute( 'rc_logid' );
-                               ChangeTags::addTags( 'mobile app edit', $rcId, 
$revId, $logId );
-                       }
+               $isWikipediaApp = strpos( $userAgent, "WikipediaApp/" ) === 0;
+               $isCommonsApp = strpos( $userAgent, "Commons/" ) === 0;
+               $logType = $rc->getAttribute( 'rc_log_type' );
+
+               // Apply tag for edits done with the Wikipedia app, and
+               // edits and uploads done with the Commons app
+               if (
+                       ( $isWikipediaApp && is_null( $logType ) )
+                       || ( $isCommonsApp && ( is_null( $logType ) || $logType 
== 'upload' ) )
+               ) {
+                       $rcId = $rc->getAttribute( 'rc_id' );
+                       $revId = $rc->getAttribute( 'rc_this_oldid' );
+                       $logId = $rc->getAttribute( 'rc_logid' );
+                       ChangeTags::addTags( 'mobile app edit', $rcId, $revId, 
$logId );
                }
                return true;
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I06ead8fb975b1586551e8f38af8e0b8f10f65532
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileApp
Gerrit-Branch: master
Gerrit-Owner: Whym <[email protected]>
Gerrit-Reviewer: BearND <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: Dbrant <[email protected]>
Gerrit-Reviewer: Fjalapeno <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: Mhurd <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>
Gerrit-Reviewer: Whym <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to