From a7b8043cc3f762a5aae9113daeafccf43c3ccf0a Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Fri, 21 Sep 2018 11:11:23 -0700 Subject: [PATCH] Remove hardcoded parentheticals from ChangesList "comments" From now on, the edit summary in ContribsPager results will be wrapped in brackets via CSS pseudo elements. Changes: * Linker::revComment and Linker::commentBlock now accept a parameter which can be used to disable wrapping in the text * ContribsPager makes use of it Bug: T205581 Change-Id: I60403a4a23d89107b7a28f0c12326d828a76614e --- includes/Linker.php | 13 +++++++++---- includes/specials/pagers/ContribsPager.php | 2 +- resources/src/mediawiki.special.changeslist.less | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index 1d1ad0696f..b0ba43fe68 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1440,7 +1440,7 @@ class Linker { * @return string */ public static function commentBlock( - $comment, $title = null, $local = false, $wikiId = null + $comment, $title = null, $local = false, $wikiId = null, $useParentheses = true ) { // '*' used to be the comment inserted by the software way back // in antiquity in case none was provided, here for backwards @@ -1449,7 +1449,9 @@ class Linker { return ''; } else { $formatted = self::formatComment( $comment, $title, $local, $wikiId ); - $formatted = wfMessage( 'parentheses' )->rawParams( $formatted )->escaped(); + if ( $useParentheses ) { + $formatted = wfMessage( 'parentheses' )->rawParams( $formatted )->escaped(); + } return " $formatted"; } } @@ -1462,9 +1464,12 @@ class Linker { * @param Revision $rev * @param bool $local Whether section links should refer to local page * @param bool $isPublic Show only if all users can see it + * @param bool $useParentheses (optional) Wrap comments in parentheses where needed * @return string HTML fragment */ - public static function revComment( Revision $rev, $local = false, $isPublic = false ) { + public static function revComment( Revision $rev, $local = false, $isPublic = false, + $useParentheses = true + ) { if ( $rev->getComment( Revision::RAW ) == "" ) { return ""; } @@ -1472,7 +1477,7 @@ class Linker { $block = " " . wfMessage( 'rev-deleted-comment' )->escaped() . ""; } elseif ( $rev->userCan( Revision::DELETED_COMMENT ) ) { $block = self::commentBlock( $rev->getComment( Revision::FOR_THIS_USER ), - $rev->getTitle(), $local ); + $rev->getTitle(), $local, null, $useParentheses ); } else { $block = " " . wfMessage( 'rev-deleted-comment' )->escaped() . ""; } diff --git a/includes/specials/pagers/ContribsPager.php b/includes/specials/pagers/ContribsPager.php index b42af9b5eb..5cfc437906 100644 --- a/includes/specials/pagers/ContribsPager.php +++ b/includes/specials/pagers/ContribsPager.php @@ -525,7 +525,7 @@ class ContribsPager extends RangeChronologicalPager { } $lang = $this->getLanguage(); - $comment = $lang->getDirMark() . Linker::revComment( $rev, false, true ); + $comment = $lang->getDirMark() . Linker::revComment( $rev, false, true, false ); $date = $lang->userTimeAndDate( $row->rev_timestamp, $user ); if ( $rev->userCan( Revision::DELETED_TEXT, $user ) ) { $d = $linkRenderer->makeKnownLink( diff --git a/resources/src/mediawiki.special.changeslist.less b/resources/src/mediawiki.special.changeslist.less index e2ee9a549c..67eece463f 100644 --- a/resources/src/mediawiki.special.changeslist.less +++ b/resources/src/mediawiki.special.changeslist.less @@ -67,6 +67,7 @@ content: '. .'; } +.comment, .mw-changeslist-links, .mw-diff-bytes, .mw-tag-markers, -- 2.20.1