X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialDeletedContributions.php;h=d625f82f77afa2a9cf7da9d72e8770aa9a1fe19c;hb=16266edff3337c893a1b5bc42e0bd006a828cde3;hp=190bf9f981c4144ad07375a6ca1a8cd26b42ff65;hpb=816e6ded007382f35df38ea8f4b5a32e8e256b78;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 190bf9f981..d625f82f77 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -98,7 +98,7 @@ class DeletedContributionsPage extends SpecialPage { return; } - # Show a message about slave lag, if applicable + # Show a message about replica DB lag, if applicable $lag = wfGetLB()->safeGetLag( $pager->getDatabase() ); if ( $lag > 0 ) { $out->showLagWarning( $lag ); @@ -129,97 +129,29 @@ class DeletedContributionsPage extends SpecialPage { * Generates the subheading with links * @param User $userObj User object for the target * @return string Appropriately-escaped HTML to be output literally - * @todo FIXME: Almost the same as contributionsSub in SpecialContributions.php. Could be combined. */ function getSubTitle( $userObj ) { + $linkRenderer = $this->getLinkRenderer(); if ( $userObj->isAnon() ) { $user = htmlspecialchars( $userObj->getName() ); } else { - $user = Linker::link( $userObj->getUserPage(), htmlspecialchars( $userObj->getName() ) ); + $user = $linkRenderer->makeKnownLink( $userObj->getUserPage(), $userObj->getName() ); } $links = ''; $nt = $userObj->getUserPage(); - $id = $userObj->getId(); $talk = $nt->getTalkPage(); if ( $talk ) { - # Talk page link - $tools[] = Linker::link( $talk, $this->msg( 'sp-contributions-talk' )->escaped() ); - if ( ( $id !== null ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) { - # Block / Change block / Unblock links - if ( $this->getUser()->isAllowed( 'block' ) ) { - if ( $userObj->isBlocked() && $userObj->getBlock()->getType() !== Block::TYPE_AUTO ) { - $tools[] = Linker::linkKnown( # Change block link - SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ), - $this->msg( 'change-blocklink' )->escaped() - ); - $tools[] = Linker::linkKnown( # Unblock link - SpecialPage::getTitleFor( 'BlockList' ), - $this->msg( 'unblocklink' )->escaped(), - [], - [ - 'action' => 'unblock', - 'ip' => $nt->getDBkey() - ] - ); - } else { - # User is not blocked - $tools[] = Linker::linkKnown( # Block link - SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ), - $this->msg( 'blocklink' )->escaped() - ); - } - } - # Block log link - $tools[] = Linker::linkKnown( - SpecialPage::getTitleFor( 'Log' ), - $this->msg( 'sp-contributions-blocklog' )->escaped(), - [], - [ - 'type' => 'block', - 'page' => $nt->getPrefixedText() - ] - ); - # Suppression log link (bug 59120) - if ( $this->getUser()->isAllowed( 'suppressionlog' ) ) { - $tools[] = Linker::linkKnown( - SpecialPage::getTitleFor( 'Log', 'suppress' ), - $this->msg( 'sp-contributions-suppresslog' )->escaped(), - [], - [ 'offender' => $userObj->getName() ] - ); - } - } + $tools = SpecialContributions::getUserLinks( $this, $userObj ); - # Uploads - $tools[] = Linker::linkKnown( - SpecialPage::getTitleFor( 'Listfiles', $userObj->getName() ), - $this->msg( 'sp-contributions-uploads' )->escaped() - ); - - # Other logs link - $tools[] = Linker::linkKnown( - SpecialPage::getTitleFor( 'Log' ), - $this->msg( 'sp-contributions-logs' )->escaped(), - [], - [ 'user' => $nt->getText() ] - ); # Link to contributions - $tools[] = Linker::linkKnown( + $insert['contribs'] = $linkRenderer->makeKnownLink( SpecialPage::getTitleFor( 'Contributions', $nt->getDBkey() ), - $this->msg( 'sp-deletedcontributions-contribs' )->escaped() + $this->msg( 'sp-deletedcontributions-contribs' )->text() ); - # Add a link to change user rights for privileged users - $userrightsPage = new UserrightsPage(); - $userrightsPage->setContext( $this->getContext() ); - if ( $userrightsPage->userCanChangeRights( $userObj ) ) { - $tools[] = Linker::linkKnown( - SpecialPage::getTitleFor( 'Userrights', $nt->getDBkey() ), - $this->msg( 'sp-contributions-userrights' )->escaped() - ); - } - - Hooks::run( 'ContributionsToolLinks', [ $id, $nt, &$tools ] ); + // Swap out the deletedcontribs link for our contribs one + $tools = wfArrayInsertAfter( $tools, $insert, 'deletedcontribs' ); + unset( $tools['deletedcontribs'] ); $links = $this->getLanguage()->pipeList( $tools );