Sbisson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/230109

Change subject: [WIP] Do not show 'reply' button for pages without LQT
......................................................................

[WIP] Do not show 'reply' button for pages without LQT

When the useliquidthreads property is removed from a page,
topics created from that page can still be replied to
from the thread namespace and Special:NewMessages.

This change prevents replying to those threads.

Bug: T107894
Change-Id: Idc5d96c9b3b2391a9c2f32a2d6d12a68099e95d6
---
M classes/Dispatch.php
M classes/Thread.php
2 files changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LiquidThreads 
refs/changes/09/230109/1

diff --git a/classes/Dispatch.php b/classes/Dispatch.php
index 3c76d91..2c42bed 100644
--- a/classes/Dispatch.php
+++ b/classes/Dispatch.php
@@ -157,8 +157,6 @@
                        return null;
                }
 
-               $articleid = $title->getArticleID();
-
                global $wgLiquidThreadsAllowUserControlNamespaces;
                global $wgLiquidThreadsAllowUserControl;
 
@@ -172,6 +170,12 @@
                        return null;
                }
 
+               return self::getUseLiquidThreadsPropValue( $title );
+       }
+
+       static function getUseLiquidThreadsPropValue( Title $title ) {
+               $articleid = $title->getArticleID();
+
                // Check instance cache.
                if ( array_key_exists( $articleid, self::$userLqtOverride ) ) {
                        $cacheVal = self::$userLqtOverride[$articleid];
diff --git a/classes/Thread.php b/classes/Thread.php
index a00c18a..cb5bbcd 100644
--- a/classes/Thread.php
+++ b/classes/Thread.php
@@ -1535,9 +1535,14 @@
                return $ok;
        }
 
-       /* N.B. Returns true, or a string with either thread or talkpage, 
noting which is
+       /* N.B. Returns boolean, or a string with either thread or talkpage, 
noting which is
           protected */
        public function canUserReply( User $user, $rigor = 'secure' ) {
+               // blocks replies if the containing article does not have 
'use-liquid-threads'
+               if ( !LqtDispatch::getUseLiquidThreadsPropValue( 
$this->article()->getTitle() ) ) {
+                       return false;
+               }
+
                $threadRestrictions = 
$this->topmostThread()->title()->getRestrictions( 'reply' );
                $talkpageRestrictions = $this->getTitle()->getRestrictions( 
'reply' );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc5d96c9b3b2391a9c2f32a2d6d12a68099e95d6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LiquidThreads
Gerrit-Branch: master
Gerrit-Owner: Sbisson <[email protected]>

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

Reply via email to