User "Krinkle" posted a comment on MediaWiki.r98839.
Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/98839#c23702
Commit summary:
The general fix is setting the directionality of added or removed bytes in
recent changes. It is always supposed to be LTR.
Details:
* Spelling of variable names and comments: formated -> formatted
* Replaced "<$tag" with Xml::element
* Added a dirmark before the username (otherwise the added or removed appear on
the other side)
Comment:
<pre>
- if( $szdiff === 0 ) {
- return "<$tag
class='mw-plusminus-null'>($formatedSize)</$tag>";
- } elseif( $szdiff > 0 ) {
- return "<$tag
class='mw-plusminus-pos'>(+$formatedSize)</$tag>";
- } else {
- return "<$tag
class='mw-plusminus-neg'>($formatedSize)</$tag>";
+ $formattedSizeClass = 'mw-plusminus-';
+ if ( $szdiff === 0 ) {
+ $formattedSizeClass .= 'null';
}
+ if ( $szdiff > 0 ) {
+ $formattedSize = '+' . $formattedSize;
+ $formattedSizeClass .= 'pos';
+ }
+ if ( $szdiff < 0 ) {
+ $formattedSizeClass .= 'neg';
+ }
</pre>
A small tip. In order to be able to easily search where message and classnames
are used, it is recommended not not split up class names, or atleast mention
the full name somewhere in a comment, like
<pre>
// mw-plusminus-null, mw-plusminus-pos, mw-plusminus-neg
$formattedSizeClass = 'mw-plusminus-';
if ( $szdiff === 0 ) {
$formattedSizeClass .= 'null';
}
if ( $szdiff > 0 ) {
$formattedSize = '+' . $formattedSize;
$formattedSizeClass .= 'pos';
}
if ( $szdiff < 0 ) {
$formattedSizeClass .= 'neg';
}
</pre>
or simply:
<pre>
if ( $szdiff === 0 ) {
$formattedSizeClass = 'mw-plusminus-null';
}
if ( $szdiff > 0 ) {
$formattedSize = '+' . $formattedSize;
$formattedSizeClass = 'mw-plusminus-pos';
}
if ( $szdiff < 0 ) {
$formattedSizeClass = 'mw-plusminus-neg';
}
</pre>
_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview