From ae42161c84fa867273eabb663a4e7ccb52ed60c6 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Fri, 4 Mar 2016 15:14:58 +0000 Subject: [PATCH] Revert "Templatize Special:Contributions lines" Breaks RevisionDelete. This reverts commit 1bce6db10e99840cfbd10fa074c93d8d96d88412. Change-Id: I8f63e002e34a9d13e2597a27e3dd918a687d1e7c --- includes/specials/SpecialContributions.php | 60 +++++++------------ .../SpecialContributionsLine.mustache | 6 -- 2 files changed, 22 insertions(+), 44 deletions(-) delete mode 100644 includes/templates/SpecialContributionsLine.mustache diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index e7ef1684ea..5a351a7967 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -1101,13 +1101,16 @@ class ContribsPager extends ReverseChronologicalPager { $userlink = ''; } - $flags = []; if ( $rev->getParentId() === 0 ) { - $flags[] = ChangesList::flag( 'newpage' ); + $nflag = ChangesList::flag( 'newpage' ); + } else { + $nflag = ''; } if ( $rev->isMinor() ) { - $flags[] = ChangesList::flag( 'minor' ); + $mflag = ChangesList::flag( 'minor' ); + } else { + $mflag = ''; } $del = Linker::getRevDeleteLink( $user, $rev, $page ); @@ -1118,6 +1121,15 @@ class ContribsPager extends ReverseChronologicalPager { $diffHistLinks = $this->msg( 'parentheses' ) ->rawParams( $difftext . $this->messages['pipe-separator'] . $histlink ) ->escaped(); + $ret = "{$del}{$d} {$diffHistLinks}{$chardiff}{$nflag}{$mflag} "; + $ret .= "{$link}{$userlink} {$comment} {$topmarktext}"; + + # Denote if username is redacted for this edit + if ( $rev->isDeleted( Revision::DELETED_USER ) ) { + $ret .= " " . + $this->msg( 'rev-deleted-user-contribs' )->escaped() . + ""; + } # Tags, if any. list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( @@ -1126,48 +1138,20 @@ class ContribsPager extends ReverseChronologicalPager { $this->getContext() ); $classes = array_merge( $classes, $newClasses ); - - $templateParams = [ - 'articleLink' => $link, - 'charDifference' => $chardiff, - 'classes' => $classes, - 'diffHistLinks' => $diffHistLinks, - 'flags' => $flags, - 'logText' => $comment, - 'revDeleteLink' => $del, - 'tagSummary' => $tagSummary, - 'timestamp' => $d, - 'topmarktext' => $topmarktext, - 'userlink' => $userlink, - ]; - - # Denote if username is redacted for this edit - if ( $rev->isDeleted( Revision::DELETED_USER ) ) { - $templateParams['rev-deleted-user-contribs'] = - $this->msg( 'rev-deleted-user-contribs' )->escaped(); - } - - $templateParser = new TemplateParser(); - $ret = $templateParser->processTemplate( - 'SpecialContributionsLine', - $templateParams - ); + $ret .= " $tagSummary"; } // Let extensions add data - Hooks::run( 'ContributionsLineEnding', [ $this, &$ret, $row, &$templateParams['classes'] ] ); + Hooks::run( 'ContributionsLineEnding', [ $this, &$ret, $row, &$classes ] ); - // TODO: Handle exceptions in the catch block above. Do any extensions rely on - // receiving empty rows? - - if ( $templateParams['classes'] === [] && $ret === '' ) { + if ( $classes === [] && $ret === '' ) { wfDebug( "Dropping Special:Contribution row that could not be formatted\n" ); - return "\n"; + $ret = "\n"; + } else { + $ret = Html::rawElement( 'li', [ 'class' => $classes ], $ret ) . "\n"; } - // FIXME: The signature of the ContributionsLineEnding hook makes it - // very awkward to move this LI wrapper into the template. - return Html::rawElement( 'li', [ 'class' => $templateParams['classes'] ], $ret ) . "\n"; + return $ret; } /** diff --git a/includes/templates/SpecialContributionsLine.mustache b/includes/templates/SpecialContributionsLine.mustache deleted file mode 100644 index 7a334014aa..0000000000 --- a/includes/templates/SpecialContributionsLine.mustache +++ /dev/null @@ -1,6 +0,0 @@ -{{{ del }}}{{{ timestamp }}} -{{{ diffHistLinks }}}{{{ charDifference }}}{{# flags }}{{{ . }}}{{/ flags }} -{{{ articleLink }}}{{{ userlink }}} -{{{ logText }}} -{{{ topmarktext }}}{{# rev-deleted-user-contribs }} {{{ . }}}{{/ rev-deleted-user-contribs }} -{{{ tagSummary }}} -- 2.20.1