Show change tags on Special:RevisionDelete
authormhutti1 <mhutti1@gmail.com>
Tue, 15 Dec 2015 19:17:47 +0000 (20:17 +0100)
committermhutti1 <mhutti1@gmail.com>
Tue, 15 Dec 2015 19:24:36 +0000 (20:24 +0100)
RevDelRevisionItem.php has been modifed to display tags and
RevDelREvisionList.php has been modifed to request tag data
its database query.

Bug: T109041
Change-Id: Icaae790b7d21a6670c692d11e25c6db7b7325530

includes/revisiondelete/RevDelRevisionItem.php
includes/revisiondelete/RevDelRevisionList.php

index 17e1fd1..e52d07c 100644 (file)
@@ -147,6 +147,10 @@ class RevDelRevisionItem extends RevDelItem {
                }
        }
 
+       /**
+        * @return string A HTML <li> element representing this revision, showing
+        * change tags and everything
+        */
        public function getHTML() {
                $difflink = $this->list->msg( 'parentheses' )
                        ->rawParams( $this->getDiffLink() )->escaped();
@@ -156,8 +160,22 @@ class RevDelRevisionItem extends RevDelItem {
                if ( $this->isDeleted() ) {
                        $revlink = "<span class=\"history-deleted\">$revlink</span>";
                }
+               $content = "$difflink $revlink $userlink $comment";
+               $attribs = array();
+               $tags = $this->getTags();
+               if ( $tags ) {
+                       list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( $tags, 'revisiondelete' );
+                       $content .= " $tagSummary";
+                       $attribs['class'] = implode( ' ', $classes );
+               }
+               return Xml::tags( 'li', $attribs, $content );
+       }
 
-               return "<li>$difflink $revlink $userlink $comment</li>";
+       /**
+        * @return string Comma-separated list of tags
+        */
+       public function getTags() {
+               return $this->row->ts_tags;
        }
 
        public function getApiData( ApiResult $result ) {
index 4a0fff8..ebce504 100644 (file)
@@ -59,20 +59,36 @@ class RevDelRevisionList extends RevDelList {
         */
        public function doQuery( $db ) {
                $ids = array_map( 'intval', $this->ids );
-               $live = $db->select(
-                       array( 'revision', 'page', 'user' ),
-                       array_merge( Revision::selectFields(), Revision::selectUserFields() ),
-                       array(
+               $queryInfo = array(
+                       'tables' => array( 'revision', 'user' ),
+                       'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ),
+                       'conds' => array(
                                'rev_page' => $this->title->getArticleID(),
                                'rev_id' => $ids,
                        ),
-                       __METHOD__,
-                       array( 'ORDER BY' => 'rev_id DESC' ),
-                       array(
+                       'options' => array( 'ORDER BY' => 'rev_id DESC' ),
+                       'join_conds' => array(
                                'page' => Revision::pageJoinCond(),
-                               'user' => Revision::userJoinCond() )
+                               'user' => Revision::userJoinCond(),
+                       ),
+               );
+               ChangeTags::modifyDisplayQuery(
+                       $queryInfo['tables'],
+                       $queryInfo['fields'],
+                       $queryInfo['conds'],
+                       $queryInfo['join_conds'],
+                       $queryInfo['options'],
+                       ''
                );
 
+               $live = $db->select(
+                       $queryInfo['tables'],
+                       $queryInfo['fields'],
+                       $queryInfo['conds'],
+                       __METHOD__,
+                       $queryInfo['options'],
+                       $queryInfo['join_conds']
+               );
                if ( $live->numRows() >= count( $ids ) ) {
                        // All requested revisions are live, keeps things simple!
                        return $live;