Mattflaschen has uploaded a new change for review.

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

Change subject: Allow parsefragment even if VE is not enabled for that title
......................................................................

Allow parsefragment even if VE is not enabled for that title

Fixes T94282

Bug: T94282
Change-Id: Id3ee4dfba669b3119b8b4cbdfab20f70061856fb
---
M ApiVisualEditor.php
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/00/201400/1

diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index 8a75a90..1320ed5 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -9,6 +9,11 @@
  */
 
 class ApiVisualEditor extends ApiBase {
+       // These are safe even if VE is not enabled on the page.
+       // This is intended for other VE interfaces, such as Flow.
+       protected static $SAFE_ACTIONS = array(
+               'parsefragment',
+       );
 
        /**
         * @var Config
@@ -266,7 +271,10 @@
                if ( !$title ) {
                        $this->dieUsageMsg( 'invalidtitle', $params['page'] );
                }
-               if ( !in_array( $title->getNamespace(), $this->veConfig->get( 
'VisualEditorNamespaces' ) ) ) {
+
+               $isSafeAction = in_array( $params['paction'], 
self::$SAFE_ACTIONS, true );
+
+               if ( !$isSafeAction && !in_array( $title->getNamespace(), 
$this->veConfig->get( 'VisualEditorNamespaces' ) ) ) {
                        $this->dieUsage( "VisualEditor is not enabled in 
namespace " .
                                $title->getNamespace(), 'novenamespace' );
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3ee4dfba669b3119b8b4cbdfab20f70061856fb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to