Page MenuHomePhabricator

Asymmetric rendering of bytes-changed in watchlists and recentchanges
Closed, ResolvedPublic


Author: happy_melon

The current method for rendering the bytes-added/removed values in watchlists is asymmetric. For a small negative change, it uses "<span class='mw-plusminus-neg'>(-84)</span>", for a large negative change it uses "<strong class='mw-plusminus-neg'>(-627)</strong>" ("strong" makes it bold), but for *any* positive number, it uses "<span class='mw-plusminus-pos'>(+19,269)</span>". This means that while large deletions are bolded, large additions (which may be adding trivia or restoring legitimately removed content) cannot be similarly highlighted. It should be trivial to extend the check to both sides of zero.

Version: unspecified
Severity: minor



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:21 PM
bzimport set Reference to bz15925.
bzimport added a subscriber: Unknown Object (MLST).

happy_melon wrote:

The code is at the bottom of /includes/RecentChange.php - I'd just replace the stacked ifs with something like this:

return '<' 
       . ( abs($szdiff) > abs($wgRCChangedSizeThreshold) ? 'strong' : 'span' ) 
       . ' class="mw-plusminus-'
       . ( $szdiff == 0 ? 'null' : ( $szdiff > 0 ? 'pos' : 'neg' ))
       . '/>(' . ( $szdiff > 0 ? '+' : '' ) 
       . $formatedSize . ')</span>';

Backwards compatible AFAIK.

happy_melon wrote:


attachment bug15925.txt ignored as obsolete

Patch appears to have completely messed up RecentChanges. The +- character parts no longer appear, and the majority of Special:RecentChanges became bolded.

Fixes bug while reverting previous commit (to RecentChange.php) related to this.

attachment bug15925.diff ignored as obsolete

Reverted r42078 in r42088 -- bad HTML completely breaks output, as well as just making the code much harder to read.

Improved per suggestions by Brion on MediaWiki-General.

attachment bug15925v2.diff ignored as obsolete

More improvements

attachment bug15925v3.diff ignored as obsolete

happy_melon wrote:

<cries in corner>Methinks I need my own copy of MediaWiki that actually runs... Such a stupid error too... </cries in corner>

Sorry for breaking the universe :-D

Only thing I wonder, why are we bothering with a new global? Wouldn't it be easier to just abs() like in the original patch?

Uses abs function instead of new global per Demon.

attachment bug15925v4.patch ignored as obsolete

happy_melon wrote:

Wouldn't using abs() on $szdiff as well obviate the need for the more complex logic test?

^demon already did it to his local copy but said nothing here.

use abs more in check, use .patch format.

attachment bug15925v5.patch ignored as obsolete

Applied correctly and with all the fixes in r42110

alexsm333 wrote:

There was a good reason why additions weren't bold: discussion pages.

With r42110 both RC and watchlist look really ugly. There are so many bold green numbers that the boldness simply becomes useless.

happy_melon wrote:

the bytecounts can be styled easily enough; {font-weight:normal;}

would do the trick. Styling can be applied at either an individual, wiki, or sitewide level. The important thing is that the facility is there to have the numbers bolded if desired.