Revert r86764, r89134, r86827 -- added a second opaque boolean parameter to Linker::commentBlock() which appeared to mostly just turn it into Linker::formatComment().

commentBlock() exists for the sole purpose of embedding a comment into parentheses if it exists so you can append it to a line of text -- if you're not putting stuff in parentheses, don't use commentBlock() because you're not generating a parenthesized comment block.
Opaque boolean parameters are also very poor form, especially when tacking on multiple ones. There was already a nasty optional '$local' boolean param, forcing all uses of this other parameter to add *two* parameters, making illegible stuff like 'false, false'.
This commit is contained in:
Brion Vibber 2011-06-14 23:50:40 +00:00
parent fb0c86db64
commit 87786e84dd
3 changed files with 6 additions and 9 deletions

View file

@ -1111,7 +1111,7 @@ class ImageHistoryList {
if ( $file->isDeleted( File::DELETED_COMMENT ) ) {
$row .= '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span>';
} else {
$row .= $this->skin->commentBlock( $description, $this->title, false, false );
$row .= $this->skin->commentBlock( $description, $this->title );
}
$row .= '</td>';

View file

@ -1343,10 +1343,10 @@ class Linker {
* @param $comment String
* @param $title Mixed: Title object (to generate link to section in autocomment) or null
* @param $local Boolean: whether section links should refer to local page
* @param $embraced Boolean: whether the formatted comment should be embraced with ()
*
* @return string
*/
static function commentBlock( $comment, $title = null, $local = false, $embraced = true ) {
static function commentBlock( $comment, $title = null, $local = false ) {
// '*' used to be the comment inserted by the software way back
// in antiquity in case none was provided, here for backwards
// compatability, acc. to brion -ævar
@ -1354,10 +1354,7 @@ class Linker {
return '';
} else {
$formatted = self::formatComment( $comment, $title, $local );
if ( $embraced ) {
$formatted = wfMessage( 'parentheses' )->rawParams( $formatted )->escaped();
}
return Html::rawElement( 'span', array( 'class' => 'comment' ), $formatted );
return " <span class=\"comment\">($formatted)</span>";
}
}
@ -1377,7 +1374,7 @@ class Linker {
if ( $rev->isDeleted( Revision::DELETED_COMMENT ) && $isPublic ) {
$block = " <span class=\"comment\">" . wfMsgHtml( 'rev-deleted-comment' ) . "</span>";
} else if ( $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 );
} else {
$block = " <span class=\"comment\">" . wfMsgHtml( 'rev-deleted-comment' ) . "</span>";

View file

@ -221,7 +221,7 @@ class ImageListPager extends TablePager {
case 'img_size':
return $this->getSkin()->formatSize( $value );
case 'img_description':
return $this->getSkin()->commentBlock( $value, null, false, false );
return $this->getSkin()->commentBlock( $value );
case 'count':
return intval( $value ) + 1;
}