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

Change subject: Don't re-implement EditPage::getCopyrightWarning()
......................................................................


Don't re-implement EditPage::getCopyrightWarning()

Bug: T144364
Change-Id: I72d6ac9e41211384c8dc777cf42c5fed49358471
---
M VisualEditorDataModule.php
1 file changed, 10 insertions(+), 19 deletions(-)

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



diff --git a/VisualEditorDataModule.php b/VisualEditorDataModule.php
index 8eac30b..7fa83a5 100644
--- a/VisualEditorDataModule.php
+++ b/VisualEditorDataModule.php
@@ -19,7 +19,7 @@
 
        public function getScript( ResourceLoaderContext $context ) {
                $msgInfo = $this->getMessageInfo( $context );
-               $parsedMessages = [];
+               $parsedMessages = $msgInfo['parsed'];
                $textMessages = [];
                foreach ( $msgInfo['parse'] as $msgKey => $msgObj ) {
                        $parsedMessages[ $msgKey ] = $msgObj->parse();
@@ -49,24 +49,13 @@
                        'visualeditor-wikitext-warning' => $context->msg( 
'visualeditor-wikitext-warning' ),
                ];
 
-               // Copyright warning (based on EditPage::getCopyrightWarning)
-               $rightsText = $this->config->get( 'RightsText' );
-               if ( $rightsText ) {
-                       $copywarnMsgArgs = [ 'copyrightwarning',
-                               '[[' . $context->msg( 'copyrightpage' 
)->inContentLanguage()->text() . ']]',
-                               $rightsText ];
-               } else {
-                       $copywarnMsgArgs = [ 'copyrightwarning2',
-                               '[[' . $context->msg( 'copyrightpage' 
)->inContentLanguage()->text() . ']]' ];
-               }
-               // EditPage supports customisation based on title, we can't 
support that
-               $title = Title::newFromText( 'Dwimmerlaik' );
-               Hooks::run( 'EditPageCopyrightWarning', [ $title, 
&$copywarnMsgArgs ] );
-               // Normalise to 'copyrightwarning' so we have a consistent key 
in the front-end
-               $parseMsgs[ 'copyrightwarning' ] = call_user_func_array(
-                       [ $context, 'msg' ],
-                       $copywarnMsgArgs
-               );
+               // Copyright warning (already parsed)
+               $parsedMsgs = [
+                       'copyrightwarning' => EditPage::getCopyrightWarning(
+                               // Use a dummy title
+                               Title::newFromText( 'Dwimmerlaik' ), 'parse'
+                       ),
+               ];
 
                // Messages to be exported as text
                $textMsgs = [
@@ -76,6 +65,8 @@
 
                return [
                        'parse' => $parseMsgs,
+                       // Already parsed
+                       'parsed' => $parsedMsgs,
                        'text' => $textMsgs,
                ];
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I72d6ac9e41211384c8dc777cf42c5fed49358471
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Alex Monk <a...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to