Merge "Block: Clean up handling of non-User targets"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 19 Nov 2018 23:56:17 +0000 (23:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 19 Nov 2018 23:56:17 +0000 (23:56 +0000)
1  2 
includes/user/User.php

@@@ -2302,9 -2302,20 +2302,20 @@@ class User implements IDBAccessObject, 
                $blocked = $this->isHidden();
  
                if ( !$blocked ) {
 -                      $block = $this->getBlock( $fromSlave );
 +                      $block = $this->getBlock( $fromReplica );
                        if ( $block ) {
-                               $blocked = $block->preventsEdit( $title );
+                               // A sitewide block covers everything except maybe the user's
+                               // talk page. A partial block covering the user's talk page
+                               // overrides the editownusertalk flag, however.
+                               // TODO: Do we really want a partial block on the user talk
+                               //  namespace to ignore editownusertalk?
+                               $blocked = $block->isSitewide();
+                               if ( $blocked && $title->equals( $this->getTalkPage() ) ) {
+                                       $blocked = $block->prevents( 'editownusertalk' );
+                               }
+                               if ( !$block->isSitewide() ) {
+                                       $blocked = $block->appliesToTitle( $title );
+                               }
                        }
                }