From c1e14db757095e7df1c92b1f22b29639a05dd4d1 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Tue, 12 Jul 2016 20:32:27 +0100 Subject: [PATCH] Don't depend on captcha extension messages in ext.visualEditor.mwcore module Create an ext.visualEditor.mwextensionmessages module in our ResourceLoaderRegisterModules hook and load them there as available instead. Bug: T139550 Change-Id: I89e942052f86291085652ae93ae8d10efefb5f44 --- VisualEditor.hooks.php | 21 +++++++++++++++++++++ extension.json | 8 ++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php index 97bdf1abd7..5ef3ccd80d 100644 --- a/VisualEditor.hooks.php +++ b/VisualEditor.hooks.php @@ -737,6 +737,27 @@ class VisualEditorHooks { ] ] ); } + $extensionMessages = []; + if ( class_exists( 'ConfirmEditHooks' ) ) { + $extensionMessages[] = 'captcha-edit'; + $extensionMessages[] = 'captcha-label'; + + if ( class_exists( 'QuestyCaptcha' ) ) { + $extensionMessages[] = 'questycaptcha-edit'; + } + + if ( class_exists( 'FancyCaptcha' ) ) { + $extensionMessages[] = 'fancycaptcha-edit'; + $extensionMessages[] = 'fancycaptcha-reload-text'; + } + } + $resourceLoader->register( [ + 'ext.visualEditor.mwextensionmessages' => $veResourceTemplate + [ + 'messages' => $extensionMessages, + 'targets' => [ 'desktop', 'mobile' ], + ] + ] ); + return true; } diff --git a/extension.json b/extension.json index 85eaa1bc0b..33edb742c7 100644 --- a/extension.json +++ b/extension.json @@ -1178,17 +1178,13 @@ "mediawiki.skinning.content.parsoid", "mediawiki.widgets", "ext.visualEditor.switching", - "ext.visualEditor.welcome" + "ext.visualEditor.welcome", + "ext.visualEditor.mwextensionmessages" ], "messages": [ - "captcha-edit", - "captcha-label", "colon-separator", - "fancycaptcha-edit", - "fancycaptcha-reload-text", "hidetoc", "ooui-dialog-process-continue", - "questycaptcha-edit", "showtoc", "summary-preview", "toc",