Merge "Specify DB to query when checking if a user is blocked from a page"
This commit is contained in:
commit
8d2bdc20c2
5 changed files with 33 additions and 5 deletions
|
|
@ -2726,7 +2726,13 @@ class EditPage implements IEditObject {
|
|||
} elseif (
|
||||
$block !== null &&
|
||||
$block->getType() != DatabaseBlock::TYPE_AUTO &&
|
||||
( $block->isSitewide() || $user->isBlockedFrom( $this->mTitle ) )
|
||||
(
|
||||
$block->isSitewide() ||
|
||||
$user->isBlockedFrom(
|
||||
$this->mTitle,
|
||||
true
|
||||
)
|
||||
)
|
||||
) {
|
||||
// Show log extract if the user is sitewide blocked or is partially
|
||||
// blocked and not allowed to edit their user page or user talk page
|
||||
|
|
|
|||
|
|
@ -337,7 +337,11 @@ abstract class Action implements MessageLocalizer {
|
|||
}
|
||||
|
||||
// If the action requires an unblock, explicitly check the user's block.
|
||||
if ( $this->requiresUnblock() && $user->isBlockedFrom( $this->getTitle() ) ) {
|
||||
$checkReplica = !$this->getRequest()->wasPosted();
|
||||
if (
|
||||
$this->requiresUnblock() &&
|
||||
$user->isBlockedFrom( $this->getTitle(), $checkReplica )
|
||||
) {
|
||||
$block = $user->getBlock();
|
||||
if ( $block ) {
|
||||
throw new UserBlockedError(
|
||||
|
|
|
|||
|
|
@ -1311,13 +1311,17 @@ class Article implements Page {
|
|||
// users, pretend like it does not exist at all.
|
||||
$user = false;
|
||||
}
|
||||
|
||||
if ( !( $user && $user->isRegistered() ) && !$ip ) { # User does not exist
|
||||
$outputPage->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
|
||||
[ 'userpage-userdoesnotexist-view', wfEscapeWikiText( $rootPart ) ] );
|
||||
} elseif (
|
||||
$block !== null &&
|
||||
$block->getType() != DatabaseBlock::TYPE_AUTO &&
|
||||
( $block->isSitewide() || $user->isBlockedFrom( $title ) )
|
||||
(
|
||||
$block->isSitewide() ||
|
||||
$user->isBlockedFrom( $title, true )
|
||||
)
|
||||
) {
|
||||
// Show log extract if the user is sitewide blocked or is partially
|
||||
// blocked and not allowed to edit their user page or user talk page
|
||||
|
|
|
|||
|
|
@ -139,7 +139,14 @@ class SpecialEditTags extends UnlistedSpecialPage {
|
|||
}
|
||||
|
||||
// Check blocks
|
||||
if ( $this->permissionManager->isBlockedFrom( $user, $this->targetObj ) ) {
|
||||
$checkReplica = !$this->submitClicked;
|
||||
if (
|
||||
$this->permissionManager->isBlockedFrom(
|
||||
$user,
|
||||
$this->targetObj,
|
||||
$checkReplica
|
||||
)
|
||||
) {
|
||||
throw new UserBlockedError(
|
||||
$user->getBlock(),
|
||||
$user,
|
||||
|
|
|
|||
|
|
@ -190,7 +190,14 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
|
|||
}
|
||||
|
||||
// Check blocks
|
||||
if ( $this->permissionManager->isBlockedFrom( $user, $this->targetObj ) ) {
|
||||
$checkReplica = !$this->submitClicked;
|
||||
if (
|
||||
$this->permissionManager->isBlockedFrom(
|
||||
$user,
|
||||
$this->targetObj,
|
||||
$checkReplica
|
||||
)
|
||||
) {
|
||||
throw new UserBlockedError(
|
||||
$user->getBlock(),
|
||||
$user,
|
||||
|
|
|
|||
Loading…
Reference in a new issue