Merge "Cache some more repeated messages in changes lists"

This commit is contained in:
jenkins-bot 2023-08-19 19:31:29 +00:00 committed by Gerrit Code Review
commit dc412f3bb5
4 changed files with 11 additions and 7 deletions

View file

@ -96,7 +96,10 @@ class HistoryAction extends FormlessAction {
// Precache various messages
if ( !isset( $this->message ) ) {
$this->message = [];
$msgs = [ 'cur', 'tooltip-cur', 'last', 'tooltip-last', 'pipe-separator' ];
$msgs = [
'cur', 'tooltip-cur', 'last', 'tooltip-last', 'pipe-separator',
'changeslist-nocomment', 'updatedmarker',
];
foreach ( $msgs as $msg ) {
$this->message[$msg] = $this->msg( $msg )->escaped();
}

View file

@ -455,12 +455,12 @@ class HistoryPager extends ReverseChronologicalPager {
$s2 = $this->formattedComments[$resultOffset];
if ( $s2 === '' ) {
$defaultComment = $this->msg( 'changeslist-nocomment' )->escaped();
$defaultComment = $this->historyPage->message['changeslist-nocomment'];
$s2 = "<span class=\"comment mw-comment-none\">$defaultComment</span>";
}
if ( $this->notificationTimestamp && $row->rev_timestamp >= $this->notificationTimestamp ) {
$s2 .= ' <span class="updatedmarker">' . $this->msg( 'updatedmarker' )->escaped() . '</span>';
$s2 .= ' <span class="updatedmarker">' . $this->historyPage->message['updatedmarker'] . '</span>';
$classes[] = 'mw-history-line-updated';
}

View file

@ -191,7 +191,7 @@ class ChangesList extends ContextSource {
$this->message = [];
foreach ( [
'cur', 'diff', 'hist', 'enhancedrc-history', 'last', 'blocklink', 'history',
'semicolon-separator', 'pipe-separator' ] as $msg
'semicolon-separator', 'pipe-separator', 'word-separator' ] as $msg
) {
$this->message[$msg] = $this->msg( $msg )->escaped();
}
@ -736,7 +736,7 @@ class ChangesList extends ContextSource {
. $formatter->getActionText()
. " $mark"
. $formatter->getComment()
. $this->msg( 'word-separator' )->escaped()
. $this->message['word-separator']
. $formatter->getActionLinks()
. Html::closeElement( 'span' );
}

View file

@ -229,7 +229,8 @@ class ContribsPager extends RangeChronologicalPager {
'diff',
'hist',
'pipe-separator',
'uctop'
'uctop',
'changeslist-nocomment',
];
foreach ( $msgs as $msg ) {
@ -764,7 +765,7 @@ class ContribsPager extends RangeChronologicalPager {
$comment = $this->formattedComments[$row->rev_id];
if ( $comment === '' ) {
$defaultComment = $this->msg( 'changeslist-nocomment' )->escaped();
$defaultComment = $this->messages['changeslist-nocomment'];
$comment = "<span class=\"comment mw-comment-none\">$defaultComment</span>";
}