From f37f0a686b771179942cc3c0e895efe8aedd333b Mon Sep 17 00:00:00 2001 From: Rob Moen Date: Wed, 10 Jul 2013 13:23:15 -0700 Subject: [PATCH] Add protected & semiprotected notices to api. Bug: 50415 Change-Id: I2966a31b909e44aa371dfe84cb68c264420e35a7 --- ApiVisualEditor.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php index 85d1ed8cd5..ea37c9a84d 100644 --- a/ApiVisualEditor.php +++ b/ApiVisualEditor.php @@ -265,6 +265,16 @@ class ApiVisualEditor extends ApiBase { if ( $parsed && $parsed['restoring'] ) { $wgVisualEditorEditNotices[] = 'editingold'; } + // Protected page + if ( $page->getNamespace() != NS_MEDIAWIKI && $page->isProtected( 'edit' ) ) { + # Is the title semi-protected? + if ( $page->isSemiProtected() ) { + $wgVisualEditorEditNotices[] = 'semiprotectedpagewarning'; + } else { + # Then it must be protected based on static groups (regular) + $wgVisualEditorEditNotices[] = 'protectedpagewarning'; + } + } if ( count( $wgVisualEditorEditNotices ) ) { foreach ( $wgVisualEditorEditNotices as $key ) { $notices[] = wfMessage( $key )->parseAsBlock();