Merge "DRY up rev link generation in History and Contributions"
[lhc/web/wiklou.git] / includes / actions / pagers / HistoryPager.php
index 9e4080d..4e9d8e9 100644 (file)
@@ -55,18 +55,20 @@ class HistoryPager extends ReverseChronologicalPager {
         * @param string $month
         * @param string $tagFilter
         * @param array $conds
+        * @param string $day
         */
        public function __construct(
                HistoryAction $historyPage,
                $year = '',
                $month = '',
                $tagFilter = '',
-               array $conds = []
+               array $conds = [],
+               $day = ''
        ) {
                parent::__construct( $historyPage->getContext() );
                $this->historyPage = $historyPage;
                $this->tagFilter = $tagFilter;
-               $this->getDateCond( $year, $month );
+               $this->getDateCond( $year, $month, $day );
                $this->conds = $conds;
                $this->showTagEditUI = ChangeTags::showTagEditingUI( $this->getUser() );
        }
@@ -183,7 +185,7 @@ class HistoryPager extends ReverseChronologicalPager {
                $s .= Html::hidden( 'type', 'revision' ) . "\n";
 
                // Button container stored in $this->buttons for re-use in getEndBody()
-               $this->buttons = '<div>';
+               $this->buttons = Html::openElement( 'div', [ 'class' => 'mw-history-compareselectedversions' ] );
                $className = 'historysubmit mw-history-compareselectedversions-button';
                $attrs = [ 'class' => $className ]
                        + Linker::tooltipAndAccesskeyAttribs( 'compareselectedversions' );
@@ -473,22 +475,8 @@ class HistoryPager extends ReverseChronologicalPager {
         * @return string
         */
        function revLink( $rev ) {
-               $date = $this->getLanguage()->userTimeAndDate( $rev->getTimestamp(), $this->getUser() );
-               if ( $rev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
-                       $link = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
-                               $this->getTitle(),
-                               $date,
-                               [ 'class' => 'mw-changeslist-date' ],
-                               [ 'oldid' => $rev->getId() ]
-                       );
-               } else {
-                       $link = htmlspecialchars( $date );
-               }
-               if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
-                       $link = "<span class=\"history-deleted\">$link</span>";
-               }
-
-               return $link;
+               return ChangesList::revDateLink( $rev, $this->getUser(), $this->getLanguage(),
+                       $this->getTitle() );
        }
 
        /**