jenkins-bot has submitted this change and it was merged.
Change subject: Show error message when user is not logged in
......................................................................
Show error message when user is not logged in
Change-Id: If513185ab518925248881aad1ea5ad415b286826
---
M i18n/en.json
M i18n/qqq.json
M specials/SpecialContentTranslation.php
3 files changed, 19 insertions(+), 10 deletions(-)
Approvals:
Santhosh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/i18n/en.json b/i18n/en.json
index 7d62a50..f60d8ce 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -13,6 +13,7 @@
"cx-publish-page-error": "Error while saving page.",
"cx-publish-button": "Publish translation",
"cx-source-loading": "Loading $1",
+ "cx-special-login-error": "You must be logged in to translate in this
page.",
"cx-tools-instructions-title": "Create a translation",
"cx-tools-instructions-text1": "Add some paragraphs to the translation.",
"cx-tools-instructions-text2": "Adjust the automatic translations provided
to ensure quality",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 856c975..e52e988 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -14,10 +14,11 @@
"cx-publish-page-error": "Error message to display when page saving
fails.",
"cx-publish-button": "Publish button text in
[[Special:ContentTranslation]].",
"cx-source-loading": "Status text shown in the source article pane while
article is being loaded.\n\nParameters:\n* $1 - the title of the page being
loaded",
+ "cx-special-login-error": "Error to show when user try to use
[[Special:ContentTranslation]] without logging in.",
"cx-tools-instructions-title": "Title for the translation aids pane.",
"cx-tools-instructions-text1": "Help text for the translation aids pane.",
"cx-tools-instructions-text2": "Help text for the translation aids pane.",
"cx-tools-instructions-text3": "Help text for the translation aids pane.",
"cx-tools-instructions-text4": "Help text for the translation aids pane.",
"cx-tools-instructions-text5": "Help text for the translation aids pane."
-}
\ No newline at end of file
+}
diff --git a/specials/SpecialContentTranslation.php
b/specials/SpecialContentTranslation.php
index 0307c84..4425981 100644
--- a/specials/SpecialContentTranslation.php
+++ b/specials/SpecialContentTranslation.php
@@ -23,16 +23,23 @@
public function execute( $parameters ) {
$out = $this->getOutput();
- $out->addModules( 'ext.cx.base' );
$skin = $this->getSkin();
- $this->setHeaders();
- $out->setArticleBodyOnly( true );
- // Default modules copied from OutputPage::addDefaultModules
- $out->addModules( array(
- 'mediawiki.user',
- 'mediawiki.page.startup',
- 'mediawiki.page.ready',
- ) );
+ $user = $this->getUser();
+
+ if ( !($user->isLoggedIn() ) ) {
+ $out->addHTML( $this->msg('cx-special-login-error'));
+ }
+ else {
+ $out->addModules( 'ext.cx.base' );
+ $this->setHeaders();
+ $out->setArticleBodyOnly( true );
+ // Default modules copied from
OutputPage::addDefaultModules
+ $out->addModules( array(
+ 'mediawiki.user',
+ 'mediawiki.page.startup',
+ 'mediawiki.page.ready',
+ ) );
+ }
$out->addHTML( $out->headElement( $skin ) );
--
To view, visit https://gerrit.wikimedia.org/r/108058
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If513185ab518925248881aad1ea5ad415b286826
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: KartikMistry <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Pginer <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: SuchetaG <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits