r100722 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100721‎ | r100722 | r100723 >
Date:18:19, 25 October 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
* Removed $wgRCShowChangedSize check in sp:Contributions for size diffs since this isn't RC
* Replaced revision size information on history pages with size diff to be consistent with other places
Modified paths:
  • /trunk/phase3/includes/actions/HistoryAction.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/actions/HistoryAction.php
@@ -498,7 +498,7 @@
499499 * @todo document some more, and maybe clean up the code (some params redundant?)
500500 *
501501 * @param $row Object: the database row corresponding to the previous line.
502 - * @param $next Mixed: the database row corresponding to the next line.
 502+ * @param $next Mixed: the database row corresponding to the next line. (chronologically previous)
503503 * @param $notificationtimestamp
504504 * @param $latest Boolean: whether this row corresponds to the page's latest revision.
505505 * @param $firstInList Boolean: whether this row corresponds to the first displayed on this history page.
@@ -510,6 +510,13 @@
511511 $rev = new Revision( $row );
512512 $rev->setTitle( $this->getTitle() );
513513
 514+ if ( is_object( $next ) ) {
 515+ $prevRev = new Revision( $next );
 516+ $prevRev->setTitle( $this->getTitle() );
 517+ } else {
 518+ $prevRev = null;
 519+ }
 520+
514521 $curlink = $this->curLink( $rev, $latest );
515522 $lastlink = $this->lastLink( $rev, $next );
516523 $diffButtons = $this->diffButtons( $rev, $firstInList );
@@ -566,8 +573,12 @@
567574 $s .= ' ' . ChangesList::flag( 'minor' );
568575 }
569576
570 - if ( !is_null( $size = $rev->getSize() ) && !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
571 - $s .= ' ' . Linker::formatRevisionSize( $size );
 577+ if ( $prevRev
 578+ && !$prevRev->isDeleted( Revision::DELETED_TEXT )
 579+ && !$rev->isDeleted( Revision::DELETED_TEXT ) )
 580+ {
 581+ $sDiff = ChangesList::showCharacterDifference( $prevRev->getSize(), $rev->getSize() );
 582+ $s .= ' . . ' . $sDiff . ' . . ';
572583 }
573584
574585 $s .= Linker::revComment( $rev, false, true );
@@ -579,7 +590,7 @@
580591 $tools = array();
581592
582593 # Rollback and undo links
583 - if ( !is_null( $next ) && is_object( $next ) &&
 594+ if ( $prevRev &&
584595 !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) ) )
585596 {
586597 if ( $latest && !count( $this->getTitle()->getUserPermissionsErrors( 'rollback', $this->getUser() ) ) ) {
@@ -589,7 +600,7 @@
590601 }
591602
592603 if ( !$rev->isDeleted( Revision::DELETED_TEXT )
593 - && !$next->rev_deleted & Revision::DELETED_TEXT )
 604+ && !$prevRev->isDeleted( Revision::DELETED_TEXT ) )
594605 {
595606 # Create undo tooltip for the first (=latest) line only
596607 $undoTooltip = $latest
@@ -600,9 +611,9 @@
601612 $this->msg( 'editundo' )->escaped(),
602613 $undoTooltip,
603614 array(
604 - 'action' => 'edit',
605 - 'undoafter' => $next->rev_id,
606 - 'undo' => $rev->getId()
 615+ 'action' => 'edit',
 616+ 'undoafter' => $prevRev->getId(),
 617+ 'undo' => $rev->getId()
607618 )
608619 );
609620 $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -549,18 +549,14 @@
550550 }
551551
552552 function doBatchLookups() {
553 - global $wgRCShowChangedSize;
554 -
555 - $this->mParentLens = array();
556 - if ( $wgRCShowChangedSize ) {
557 - $this->mResult->rewind();
558 - $revIds = array();
559 - foreach ( $this->mResult as $row ) {
560 - $revIds[] = $row->rev_parent_id;
561 - }
562 - $this->mParentLens = $this->getParentLengths( $revIds );
563 - $this->mResult->rewind(); // reset
 553+ $this->mResult->rewind();
 554+ $revIds = array();
 555+ foreach ( $this->mResult as $row ) {
 556+ $revIds[] = $row->rev_parent_id;
564557 }
 558+ $this->mParentLens = $this->getParentLengths( $revIds );
 559+ $this->mResult->rewind(); // reset
 560+
565561 if ( $this->contribs === 'newbie' ) { // multiple users
566562 # Do a link batch query
567563 $this->mResult->seek( 0 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r104085Followup r100722, show the full size of the page in the tooltipjohnduhart21:01, 23 November 2011

Comments

#Comment by Raymond (talk | contribs)   18:33, 25 October 2011
* Replaced revision size information on history pages with size diff to be consistent with other places

I am not sure if I like this...

#Comment by Raymond (talk | contribs)   10:05, 23 November 2011

Marking as FIXME because it is a regression to 1.18. The real page size is nowhere visible now :-(

I suggest to add the page size, something like "(+ 100 Byte; 64.508 Bytes) "

#Comment by Johnduhart (talk | contribs)   10:40, 23 November 2011

I like the size diffs on the History page idea, maybe the full size could be kept as a tooltip on the diff?

#Comment by Brion VIBBER (talk | contribs)   20:44, 23 November 2011

I'm not against that and suspect it would make the power users happy (gadgets could easily extract it and put it back in the line if people so wish).

If done, the tooltip should probably be added in common code in ChangesList::showCharacterDifference so it's used in all the usual places.

#Comment by Brion VIBBER (talk | contribs)   21:11, 23 November 2011

john did this in r104085, it looks good. :) De-fixme'ing

#Comment by Brion VIBBER (talk | contribs)   20:42, 23 November 2011

"Real page size" is a usually useless bit of info unrelated to the actual edit action; I'm glad to have it gone. Really though there needs to be a complete 100% overhaul of the UI for all of these places; for the power users letting them customize their columns might be nice. :)

#Comment by Aaron Schulz (talk | contribs)   20:33, 23 November 2011

The total size info was clutter. I also talked to Brandon about this.

#Comment by Bawolff (talk | contribs)   23:47, 4 March 2012

This results in incorrect info being displayed if the history page is filtered (I think its this revision's fault). Example: https://en.wikipedia.org/w/index.php?title=Milton_Keynes&action=history&year=&month=-1&tagfilter=possible+vandalism See bugzilla:34922#c4

Status & tagging log