Remove hardcoded parentheticals from ChangesList "comments"
authorjdlrobson <jdlrobson@gmail.com>
Fri, 21 Sep 2018 18:11:23 +0000 (11:11 -0700)
committerVolkerE <volker.e@wikimedia.org>
Wed, 21 Nov 2018 20:15:06 +0000 (20:15 +0000)
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
includes/specials/pagers/ContribsPager.php
resources/src/mediawiki.special.changeslist.less

index 1d1ad06..b0ba43f 100644 (file)
@@ -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 " <span class=\"comment\">$formatted</span>";
                }
        }
@@ -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 = " <span class=\"comment\">" . wfMessage( 'rev-deleted-comment' )->escaped() . "</span>";
                } 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 = " <span class=\"comment\">" . wfMessage( 'rev-deleted-comment' )->escaped() . "</span>";
                }
index b42af9b..5cfc437 100644 (file)
@@ -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(
index e2ee9a5..67eece4 100644 (file)
@@ -67,6 +67,7 @@
        content: '. .';
 }
 
+.comment,
 .mw-changeslist-links,
 .mw-diff-bytes,
 .mw-tag-markers,