X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fchanges%2FChangesList.php;h=184a2c10e6086f89ea866d227354e7e827749317;hp=b8ab971b94d3750ff47eb33092f23e977d6d2f72;hb=a38af7ba26579bb3004f673e44d39710887763aa;hpb=4d0773cd01f08b05ceaaadd1c8d8cbca4756d0d0 diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index b8ab971b94..184a2c10e6 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -289,7 +289,10 @@ class ChangesList extends ContextSource { $this->rcCacheIndex = 0; $this->lastdate = ''; $this->rclistOpen = false; - $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' ); + $this->getOutput()->addModuleStyles( [ + 'mediawiki.interface.helpers.styles', + 'mediawiki.special.changeslist' + ] ); return '
'; } @@ -392,6 +395,36 @@ class ChangesList extends ContextSource { return $out; } + /** + * Render the date and time of a revision in the current user language + * based on whether the user is able to view this information or not. + * @param Revision $rev + * @param User $user + * @param Language $lang + * @param Title|null $title (optional) where Title does not match + * the Title associated with the Revision + * @internal For usage by Pager classes only (e.g. HistoryPager and ContribsPager). + * @return string HTML + */ + public static function revDateLink( Revision $rev, User $user, Language $lang, $title = null ) { + $ts = $rev->getTimestamp(); + $date = $lang->userTimeAndDate( $ts, $user ); + if ( $rev->userCan( Revision::DELETED_TEXT, $user ) ) { + $link = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink( + $title !== null ? $title : $rev->getTitle(), + $date, + [ 'class' => 'mw-changeslist-date' ], + [ 'oldid' => $rev->getId() ] + ); + } else { + $link = htmlspecialchars( $date ); + } + if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) { + $link = "$link"; + } + return $link; + } + /** * @param string &$s HTML to update * @param mixed $rc_timestamp @@ -514,6 +547,7 @@ class ChangesList extends ContextSource { * and a separator * * @param RecentChange $rc + * @deprecated use revDateLink instead. * @return string HTML fragment */ public function getTimestamp( $rc ) { @@ -583,7 +617,13 @@ class ChangesList extends ContextSource { return ' ' . $this->msg( 'rev-deleted-comment' )->escaped() . ''; } else { - return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() ); + return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle(), + // Whether section links should refer to local page (using default false) + false, + // wikid to generate links for (using default null) */ + null, + // whether parentheses should be rendered as part of the message + false ); } }