Merge "Enable users to watch category membership changes #2"
[lhc/web/wiklou.git] / includes / changes / ChangesList.php
index 01f10d8..9ac6c32 100644 (file)
@@ -320,7 +320,11 @@ class ChangesList extends ContextSource {
         */
        public function insertDiffHist( &$s, &$rc, $unpatrolled ) {
                # Diff link
-               if ( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
+               if (
+                       $rc->mAttribs['rc_type'] == RC_NEW ||
+                       $rc->mAttribs['rc_type'] == RC_LOG ||
+                       $rc->mAttribs['rc_type'] == RC_CATEGORIZE
+               ) {
                        $diffLink = $this->message['diff'];
                } elseif ( !self::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
                        $diffLink = $this->message['diff'];
@@ -338,17 +342,22 @@ class ChangesList extends ContextSource {
                                $query
                        );
                }
-               $diffhist = $diffLink . $this->message['pipe-separator'];
-               # History link
-               $diffhist .= Linker::linkKnown(
-                       $rc->getTitle(),
-                       $this->message['hist'],
-                       array(),
-                       array(
-                               'curid' => $rc->mAttribs['rc_cur_id'],
-                               'action' => 'history'
-                       )
-               );
+               if ( $rc->mAttribs['rc_type'] == RC_CATEGORIZE ) {
+                       $diffhist = $diffLink . $this->message['pipe-separator'] . $this->message['hist'];
+               } else {
+                       $diffhist = $diffLink . $this->message['pipe-separator'];
+                       # History link
+                       $diffhist .= Linker::linkKnown(
+                               $rc->getTitle(),
+                               $this->message['hist'],
+                               array(),
+                               array(
+                                       'curid' => $rc->mAttribs['rc_cur_id'],
+                                       'action' => 'history'
+                               )
+                       );
+               }
+
                // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
                $s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() .
                        ' <span class="mw-changeslist-separator">. .</span> ';
@@ -645,4 +654,19 @@ class ChangesList extends ContextSource {
 
                return false;
        }
+
+       /**
+        * Determines whether a revision is linked to this change; this may not be the case
+        * when the categorization wasn't done by an edit but a conditional parser function
+        *
+        * @since 1.27
+        *
+        * @param RecentChange|RCCacheEntry $rcObj
+        * @return bool
+        */
+       protected function isCategorizationWithoutRevision( $rcObj ) {
+               return intval( $rcObj->getAttribute( 'rc_type' ) ) === RC_CATEGORIZE
+                       && intval( $rcObj->getAttribute( 'rc_this_oldid' ) ) === 0;
+       }
+
 }