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
This commit is contained in:
parent
1a5b26f0b6
commit
a7b8043cc3
3 changed files with 11 additions and 5 deletions
|
|
@ -1440,7 +1440,7 @@ class Linker {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function commentBlock(
|
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
|
// '*' used to be the comment inserted by the software way back
|
||||||
// in antiquity in case none was provided, here for backwards
|
// in antiquity in case none was provided, here for backwards
|
||||||
|
|
@ -1449,7 +1449,9 @@ class Linker {
|
||||||
return '';
|
return '';
|
||||||
} else {
|
} else {
|
||||||
$formatted = self::formatComment( $comment, $title, $local, $wikiId );
|
$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>";
|
return " <span class=\"comment\">$formatted</span>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1462,9 +1464,12 @@ class Linker {
|
||||||
* @param Revision $rev
|
* @param Revision $rev
|
||||||
* @param bool $local Whether section links should refer to local page
|
* @param bool $local Whether section links should refer to local page
|
||||||
* @param bool $isPublic Show only if all users can see it
|
* @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
|
* @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 ) == "" ) {
|
if ( $rev->getComment( Revision::RAW ) == "" ) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
@ -1472,7 +1477,7 @@ class Linker {
|
||||||
$block = " <span class=\"comment\">" . wfMessage( 'rev-deleted-comment' )->escaped() . "</span>";
|
$block = " <span class=\"comment\">" . wfMessage( 'rev-deleted-comment' )->escaped() . "</span>";
|
||||||
} elseif ( $rev->userCan( Revision::DELETED_COMMENT ) ) {
|
} elseif ( $rev->userCan( Revision::DELETED_COMMENT ) ) {
|
||||||
$block = self::commentBlock( $rev->getComment( Revision::FOR_THIS_USER ),
|
$block = self::commentBlock( $rev->getComment( Revision::FOR_THIS_USER ),
|
||||||
$rev->getTitle(), $local );
|
$rev->getTitle(), $local, null, $useParentheses );
|
||||||
} else {
|
} else {
|
||||||
$block = " <span class=\"comment\">" . wfMessage( 'rev-deleted-comment' )->escaped() . "</span>";
|
$block = " <span class=\"comment\">" . wfMessage( 'rev-deleted-comment' )->escaped() . "</span>";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -525,7 +525,7 @@ class ContribsPager extends RangeChronologicalPager {
|
||||||
}
|
}
|
||||||
|
|
||||||
$lang = $this->getLanguage();
|
$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 );
|
$date = $lang->userTimeAndDate( $row->rev_timestamp, $user );
|
||||||
if ( $rev->userCan( Revision::DELETED_TEXT, $user ) ) {
|
if ( $rev->userCan( Revision::DELETED_TEXT, $user ) ) {
|
||||||
$d = $linkRenderer->makeKnownLink(
|
$d = $linkRenderer->makeKnownLink(
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@
|
||||||
content: '. .';
|
content: '. .';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.comment,
|
||||||
.mw-changeslist-links,
|
.mw-changeslist-links,
|
||||||
.mw-diff-bytes,
|
.mw-diff-bytes,
|
||||||
.mw-tag-markers,
|
.mw-tag-markers,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue