Merge "Option to associate a rev id to a RC log entry, allowing unpatrolled status"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 6 Jan 2016 22:04:10 +0000 (22:04 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 6 Jan 2016 22:04:10 +0000 (22:04 +0000)
1  2 
includes/changes/OldChangesList.php
includes/changes/RecentChange.php

@@@ -74,10 -74,16 +74,16 @@@ class OldChangesList extends ChangesLis
         */
        private function formatChangeLine( RecentChange $rc, array &$classes, $watched ) {
                $html = '';
+               $unpatrolled = $this->showAsUnpatrolled( $rc );
  
                if ( $rc->mAttribs['rc_log_type'] ) {
                        $logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] );
                        $this->insertLog( $html, $logtitle, $rc->mAttribs['rc_log_type'] );
+                       $flags = $this->recentChangesFlags( array( 'unpatrolled' =>$unpatrolled,
+                               'bot' => $rc->mAttribs['rc_bot'] ), '' );
+                       if ( $flags !== '' ) {
+                               $html .= ' ' . $flags;
+                       }
                // Log entries (old format) or log targets, and special pages
                } elseif ( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
                        list( $name, $htmlubpage ) = SpecialPageFactory::resolveAlias( $rc->mAttribs['rc_title'] );
@@@ -86,7 -92,6 +92,6 @@@
                        }
                // Regular entries
                } else {
-                       $unpatrolled = $this->showAsUnpatrolled( $rc );
                        $this->insertDiffHist( $html, $rc, $unpatrolled );
                        # M, N, b and ! (minor, new, bot and unpatrolled)
                        $html .= $this->recentChangesFlags(
                                ),
                                ''
                        );
 -                      $this->insertArticleLink( $html, $rc, $unpatrolled, $watched );
 +                      $html .= $this->getArticleLink( $rc, $unpatrolled, $watched );
                }
                # Edit/log timestamp
                $this->insertTimestamp( $html, $rc );
@@@ -700,10 -700,12 +700,12 @@@ class RecentChange 
         * @param string $params
         * @param int $newId
         * @param string $actionCommentIRC
+        * @param int $revId Id of associated revision, if any
         * @return RecentChange
         */
        public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip,
-               $type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '' ) {
+               $type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '',
+               $revId = 0 ) {
                global $wgRequest;
  
                # # Get pageStatus for email notification
                                break;
                }
  
+               // Allow unpatrolled status when an associated rev id is passed
+               // May be used in core by moves and uploads
+               $markPatrolled = ( $revId > 0 ) ? $user->isAllowed( 'autopatrol' ) : true;
                $rc = new RecentChange;
                $rc->mTitle = $target;
                $rc->mPerformer = $user;
                        'rc_user' => $user->getId(),
                        'rc_user_text' => $user->getName(),
                        'rc_comment' => $logComment,
-                       'rc_this_oldid' => 0,
+                       'rc_this_oldid' => $revId,
                        'rc_last_oldid' => 0,
                        'rc_bot' => $user->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot', true ) : 0,
                        'rc_ip' => self::checkIPAddress( $ip ),
-                       'rc_patrolled' => 1,
+                       'rc_patrolled' => $markPatrolled ? 1 : 0,
                        'rc_new' => 0, # obsolete
                        'rc_old_len' => null,
                        'rc_new_len' => null,
                return $unserializedParams;
        }
  }
 -