$target = $par ?? $request->getVal( 'target' );
- if ( $request->getVal( 'contribs' ) == 'newbie' || $par === 'newbies' ) {
- $target = 'newbies';
- $this->opts['contribs'] = 'newbie';
- } else {
- $this->opts['contribs'] = 'user';
- }
-
$this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
if ( !strlen( $target ) ) {
$this->opts['hideMinor'] = $request->getBool( 'hideMinor' );
$id = 0;
- if ( $this->opts['contribs'] === 'newbie' ) {
- $userObj = User::newFromName( $target ); // hysterical raisins
- $out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub' ) );
- $out->setHTMLTitle( $this->msg(
- 'pagetitle',
- $this->msg( 'sp-contributions-newbies-title' )->plain()
- )->inContentLanguage() );
- } elseif ( ExternalUserNames::isExternal( $target ) ) {
+ if ( ExternalUserNames::isExternal( $target ) ) {
$userObj = User::newFromName( $target, false );
if ( !$userObj ) {
$out->addHTML( $this->getForm() );
// Allows reverts to have the bot flag in recent changes. It is just here to
// be passed in the form at the top of the page
- if ( $user->isAllowed( 'markbotedits' ) && $request->getBool( 'bot' ) ) {
+ if ( MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->userHasRight( $user, 'markbotedits' ) && $request->getBool( 'bot' )
+ ) {
$this->opts['bot'] = '1';
}
}
$pager = new ContribsPager( $this->getContext(), [
'target' => $target,
- 'contribs' => $this->opts['contribs'],
'namespace' => $this->opts['namespace'],
'tagfilter' => $this->opts['tagfilter'],
'start' => $this->opts['start'],
'hideMinor' => $this->opts['hideMinor'],
'nsInvert' => $this->opts['nsInvert'],
'associated' => $this->opts['associated'],
- ] );
+ ], $this->getLinkRenderer() );
if ( IP::isValidRange( $target ) && !$pager->isQueryableRange( $target ) ) {
// Valid range, but outside CIDR limit.
$out->preventClickjacking( $pager->getPreventClickjacking() );
# Show the appropriate "footer" message - WHOIS tools, etc.
- if ( $this->opts['contribs'] == 'newbie' ) {
- $message = 'sp-contributions-footer-newbies';
- } elseif ( IP::isValidRange( $target ) ) {
+ if ( IP::isValidRange( $target ) ) {
$message = 'sp-contributions-footer-anon-range';
} elseif ( IP::isIPAddress( $target ) ) {
$message = 'sp-contributions-footer-anon';
$linkRenderer = $sp->getLinkRenderer();
+ $tools = [];
# No talk pages for IP ranges.
if ( !$isRange ) {
$tools['user-talk'] = $linkRenderer->makeLink(
);
}
- if ( $sp->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
+ # Block / Change block / Unblock links
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
+ if ( $permissionManager->userHasRight( $sp->getUser(), 'block' ) ) {
if ( $target->getBlock() && $target->getBlock()->getType() != DatabaseBlock::TYPE_AUTO ) {
$tools['block'] = $linkRenderer->makeKnownLink( # Change block link
SpecialPage::getTitleFor( 'Block', $username ),
);
# Suppression log link (T61120)
- if ( $sp->getUser()->isAllowed( 'suppressionlog' ) ) {
+ if ( $permissionManager->userHasRight( $sp->getUser(), 'suppressionlog' ) ) {
$tools['log-suppression'] = $linkRenderer->makeKnownLink(
SpecialPage::getTitleFor( 'Log', 'suppress' ),
$sp->msg( 'sp-contributions-suppresslog', $username )->text(),
# Don't show some links for IP ranges
if ( !$isRange ) {
# Uploads: hide if IPs cannot upload (T220674)
- if ( !$isIP || $target->isAllowed( 'upload' ) ) {
+ if ( !$isIP || $permissionManager->userHasRight( $target, 'upload' ) ) {
$tools['uploads'] = $linkRenderer->makeKnownLink(
SpecialPage::getTitleFor( 'Listfiles', $username ),
$sp->msg( 'sp-contributions-uploads' )->text()
# Add link to deleted user contributions for priviledged users
# Todo: T183457
- if ( $sp->getUser()->isAllowed( 'deletedhistory' ) ) {
+ if ( $permissionManager->userHasRight( $sp->getUser(), 'deletedhistory' ) ) {
$tools['deletedcontribs'] = $linkRenderer->makeKnownLink(
SpecialPage::getTitleFor( 'DeletedContributions', $username ),
$sp->msg( 'sp-contributions-deleted', $username )->text()
$this->opts['associated'] = false;
}
- if ( !isset( $this->opts['contribs'] ) ) {
- $this->opts['contribs'] = 'user';
- }
-
if ( !isset( $this->opts['start'] ) ) {
$this->opts['start'] = '';
}
$this->opts['end'] = '';
}
- if ( $this->opts['contribs'] == 'newbie' ) {
- $this->opts['target'] = '';
- }
-
if ( !isset( $this->opts['tagfilter'] ) ) {
$this->opts['tagfilter'] = '';
}
$filterSelection = Html::rawElement( 'div', [], '' );
}
- $labelNewbies = Xml::radioLabel(
- $this->msg( 'sp-contributions-newbies' )->text(),
- 'contribs',
- 'newbie',
- 'newbie',
- $this->opts['contribs'] == 'newbie',
- [ 'class' => 'mw-input' ]
- );
- $labelUsername = Xml::radioLabel(
+ $labelUsername = Xml::label(
$this->msg( 'sp-contributions-username' )->text(),
- 'contribs',
- 'user',
- 'user',
- $this->opts['contribs'] == 'user',
- [ 'class' => 'mw-input' ]
+ 'mw-target-user-or-ip'
);
$input = Html::input(
'target',
'mw-autocomplete-user', // used by mediawiki.userSuggest
],
] + (
- // Only autofocus if target hasn't been specified or in non-newbies mode
- ( $this->opts['contribs'] === 'newbie' || $this->opts['target'] )
- ? [] : [ 'autofocus' => true ]
- )
+ // Only autofocus if target hasn't been specified
+ $this->opts['target'] ? [] : [ 'autofocus' => true ]
+ )
);
$targetSelection = Html::rawElement(
'div',
[],
- $labelNewbies . '<br>' . $labelUsername . ' ' . $input . ' '
+ $labelUsername . ' ' . $input . ' '
);
$hidden = $this->opts['namespace'] === '' ? ' mw-input-hidden' : '';
$filters = [];
- if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) {
+ if ( MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->userHasRight( $this->getUser(), 'deletedhistory' )
+ ) {
$filters[] = Html::rawElement(
'span',
[ 'class' => 'mw-input-with-label' ],