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

Change subject: (bug 42722) Show Protect Feedback (action=protect) for pages in 
whitelisted namespaces only
......................................................................


(bug 42722) Show Protect Feedback (action=protect) for pages in whitelisted 
namespaces only

Bug: 42722
Change-Id: Ibcb2a78d51332df1ab805890a34aef5e07c1a142
---
M ArticleFeedbackv5.hooks.php
1 file changed, 13 insertions(+), 2 deletions(-)

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



diff --git a/ArticleFeedbackv5.hooks.php b/ArticleFeedbackv5.hooks.php
index e661153..a58663a 100644
--- a/ArticleFeedbackv5.hooks.php
+++ b/ArticleFeedbackv5.hooks.php
@@ -607,7 +607,13 @@
         * @return bool
         */
        public static function onProtectionForm( Page $article, &$output ) {
-               global $wgLang, $wgUser;
+               global $wgLang, $wgUser, $wgArticleFeedbackv5Namespaces;
+
+               // only on pages in namespaces where it is enabled
+               if ( !$article->getTitle()->inNamespaces( 
$wgArticleFeedbackv5Namespaces ) ) {
+                       return true;
+               }
+
                $permErrors = $article->getTitle()->getUserPermissionsErrors( 
'protect', $wgUser );
                if ( wfReadOnly() ) {
                        $permErrors[] = array( 'readonlytext', 
wfReadOnlyReason() );
@@ -752,7 +758,12 @@
         * @return bool
         */
        public static function onProtectionSave( Page $article, &$errorMsg ) {
-               global $wgRequest;
+               global $wgRequest, $wgArticleFeedbackv5Namespaces;
+
+               // only on pages in namespaces where it is enabled
+               if ( !$article->getTitle()->inNamespaces( 
$wgArticleFeedbackv5Namespaces ) ) {
+                       return true;
+               }
 
                $requestPermission = $wgRequest->getVal( 
'articlefeedbackv5-protection-level' );
                $requestExpiry = $wgRequest->getText( 
'articlefeedbackv5-protection-expiration' );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibcb2a78d51332df1ab805890a34aef5e07c1a142
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/ArticleFeedbackv5
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to