Better guess for patrol action
authorcenarium <cenarium.sysop@gmail.com>
Wed, 13 Jan 2016 16:43:02 +0000 (17:43 +0100)
committercenarium <cenarium.sysop@gmail.com>
Wed, 13 Jan 2016 16:43:02 +0000 (17:43 +0100)
The "return to" guess of the patrol action for non-JS users now also
checks uploads, and in that case let users return to Special:NewFiles.

Change-Id: Ib8e472c16b7034524ef3b79a5eb426f7edda6ec2

includes/actions/MarkpatrolledAction.php

index 4016f67..ec873d9 100644 (file)
@@ -63,8 +63,14 @@ class MarkpatrolledAction extends FormlessAction {
                }
 
                # It would be nice to see where the user had actually come from, but for now just guess
-               $returnto = $rc->getAttribute( 'rc_type' ) == RC_NEW ? 'Newpages' : 'Recentchanges';
-               $return = SpecialPage::getTitleFor( $returnto );
+               if ( $rc->getAttribute( 'rc_type' ) == RC_NEW ) {
+                       $returnTo =  'Newpages';
+               } elseif ( $rc->getAttribute( 'rc_log_type' ) == 'upload' ) {
+                       $returnTo = 'Newfiles';
+               } else {
+                       $returnTo =  'Recentchanges';
+               }
+               $return = SpecialPage::getTitleFor( $returnTo );
 
                if ( in_array( array( 'markedaspatrollederror-noautopatrol' ), $errors ) ) {
                        $this->getOutput()->setPageTitle( $this->msg( 'markedaspatrollederror' ) );