X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fchanges%2FChangesList.php;h=5b8559e68ad618f1f1a50dae7a3c1ac80c548310;hb=6f7e982df6479e27c3b17f2deda8404ef55f50e6;hp=65eb3205c5457a4cf8d5eed10d6f95030204c8f0;hpb=15b3664ee12ac94a92d1057dab5645370276d027;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index 65eb3205c5..5b8559e68a 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -41,6 +41,9 @@ class ChangesList extends ContextSource { protected $rclistOpen; protected $rcMoveIndex; + /** @var callable */ + protected $changeLinePrefixer; + /** @var BagOStuff */ protected $watchMsgCache; @@ -169,17 +172,19 @@ class ChangesList extends ContextSource { * @return array of classes */ protected function getHTMLClasses( $rc, $watched ) { - $classes = []; + $classes = [ self::CSS_CLASS_PREFIX . 'line' ]; $logType = $rc->mAttribs['rc_log_type']; if ( $logType ) { + $classes[] = self::CSS_CLASS_PREFIX . 'log'; $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'log-' . $logType ); } else { + $classes[] = self::CSS_CLASS_PREFIX . 'edit'; $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns' . $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] ); - $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns-' . - $rc->mAttribs['rc_namespace'] ); } + $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns-' . + $rc->mAttribs['rc_namespace'] ); // Indicate watched status on the line to allow for more // comprehensive styling. @@ -571,7 +576,9 @@ class ChangesList extends ContextSource { return ''; } $cache = $this->watchMsgCache; - return $cache->getWithSetCallback( $count, $cache::TTL_INDEFINITE, + return $cache->getWithSetCallback( + $cache->makeKey( 'watching-users-msg', $count ), + $cache::TTL_INDEFINITE, function () use ( $count ) { return $this->msg( 'number_of_watching_users_RCview' ) ->numParams( $count )->escaped(); @@ -766,4 +773,15 @@ class ChangesList extends ContextSource { return $attrs; } + + /** + * Sets the callable that generates a change line prefix added to the beginning of each line. + * + * @param callable $prefixer Callable to run that generates the change line prefix. + * Takes three parameters: a RecentChange object, a ChangesList object, + * and whether the current entry is a grouped entry. + */ + public function setChangeLinePrefixer( callable $prefixer ) { + $this->changeLinePrefixer = $prefixer; + } }