jenkins-bot has submitted this change and it was merged.

Change subject: Avoid constant master ipblocks queries on page views
......................................................................


Avoid constant master ipblocks queries on page views

Bug: T92357
Change-Id: I1681f5bbc746d07ce3e9e4ec75094e59f83acb36
---
M classes/Thread.php
M classes/View.php
2 files changed, 8 insertions(+), 7 deletions(-)

Approvals:
  Chad: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/classes/Thread.php b/classes/Thread.php
index 19c3e1a..a00c18a 100644
--- a/classes/Thread.php
+++ b/classes/Thread.php
@@ -1537,7 +1537,7 @@
 
        /* N.B. Returns true, or a string with either thread or talkpage, 
noting which is
           protected */
-       public function canUserReply( $user ) {
+       public function canUserReply( User $user, $rigor = 'secure' ) {
                $threadRestrictions = 
$this->topmostThread()->title()->getRestrictions( 'reply' );
                $talkpageRestrictions = $this->getTitle()->getRestrictions( 
'reply' );
 
@@ -1553,7 +1553,7 @@
                        }
                }
 
-               return self::canUserCreateThreads( $user );
+               return self::canUserCreateThreads( $user, $rigor );
        }
 
        public static function canUserPost( $user, $talkpage ) {
@@ -1569,13 +1569,14 @@
        }
 
        // Generally, not some specific page
-       public static function canUserCreateThreads( $user ) {
+       public static function canUserCreateThreads( $user, $rigor = 'secure' ) 
{
                $userText = $user->getName();
 
                static $canCreateNew = array();
                if ( !isset( $canCreateNew[$userText] ) ) {
                        $title = Title::makeTitleSafe( NS_LQT_THREAD, 'Test 
title for LQT thread creation check' );
-                       $canCreateNew[$userText] = $title->userCan( 'create' ) 
&& $title->userCan( 'edit' );
+                       $canCreateNew[$userText] = $title->userCan( 'create', 
$user, $rigor )
+                               && $title->userCan( 'edit', $user, $rigor );
                }
 
                return $canCreateNew[$userText];
diff --git a/classes/View.php b/classes/View.php
index b7d6595..0f6eb10 100644
--- a/classes/View.php
+++ b/classes/View.php
@@ -597,7 +597,7 @@
                $nonce_key = wfMemcKey( 'lqt-nonce', $submitted_nonce, 
$this->user->getName() );
                if ( ! $this->handleNonce( $submitted_nonce, $nonce_key ) ) 
return;
 
-               $perm_result = $thread->canUserReply( $this->user );
+               $perm_result = $thread->canUserReply( $this->user, 'quick' );
                if ( $perm_result !== true ) {
                        $this->showReplyProtectedNotice( $thread );
                        return;
@@ -1270,7 +1270,7 @@
                        );
                }
 
-               if ( $thread->canUserReply( $this->user ) === true ) {
+               if ( $thread->canUserReply( $this->user, 'quick' ) === true ) {
                        $commands['reply'] = array(
                                'label' => wfMessage( 'lqt_reply' )->parse(),
                                 'href' => $this->talkpageUrl( $this->title, 
'reply', $thread,
@@ -2227,7 +2227,7 @@
                if ( $this->methodAppliesToThread( 'reply', $thread ) ) {
                        $this->showReplyForm( $thread );
                        return;
-               } elseif ( !$thread->canUserReply( $this->user ) ) {
+               } elseif ( !$thread->canUserReply( $this->user, 'quick' ) ) {
                        return;
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/203432
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1681f5bbc746d07ce3e9e4ec75094e59f83acb36
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/LiquidThreads
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Werdna <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to