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

Change subject: Show error message instead of exception when only language 
chosen is source language
......................................................................


Show error message instead of exception when only language chosen is source 
language

This is not a case where a software exception should be thrown but is a case
where an error message should be reported to the user.

Bug: T62393
Change-Id: I85fff2fc47b57c2e7742292c3abb199f2cbba823
---
M SpecialNotifyTranslators.php
M i18n/en.json
M i18n/qqq.json
3 files changed, 4 insertions(+), 3 deletions(-)

Approvals:
  Nikerabbit: Checked; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/SpecialNotifyTranslators.php b/SpecialNotifyTranslators.php
index 60aca85..1d8d56d 100644
--- a/SpecialNotifyTranslators.php
+++ b/SpecialNotifyTranslators.php
@@ -219,8 +219,7 @@
                        $languagesToNotify = $translatorsConds['up_value'];
 
                        if ( count( $languagesToNotify ) === 0 ) {
-                               throw new MWException( "A notification must not 
be sent only to " .
-                                       "translators to the source language." );
+                               return Status::newFatal( 
'translationnotifications-sourcelang-only' );
                        }
 
                        $languagesForLog = $this->getLanguage()->commaList( 
$languagesToNotify );
diff --git a/i18n/en.json b/i18n/en.json
index 73d122e..32c8836 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -38,6 +38,7 @@
        "translationnotifications-deadline-label": "Deadline to indicate in 
this notification:",
        "translationnotifications-languages-to-notify-label": "Which languages 
to notify:",
        "translationnotifications-languages-to-notify-label-help-message": 
"Comma-separated language codes; leave blank to notify for all languages.",
+       "translationnotifications-sourcelang-only": "A notification cannot be 
sent only to translators of the source language.",
        "translationnotifications-priority": "Priority:",
        "translationnotifications-priority-high": "high",
        "translationnotifications-priority-medium": "medium",
@@ -65,4 +66,4 @@
        "translationnotifications-signup-legal": "You agree that by providing 
this information we may contact you regarding topics related to {{SITENAME}} we 
think may be of interest to you. You agree your data is subject to our 
[[{{MediaWiki:Privacypage}}|privacy policy]].",
        "translationnotifications-generic-languages": "<languages>",
        "translationnotifications-text": "Use the form below to send 
translation requests to translators."
-}
\ No newline at end of file
+}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 1966496..2e64ab3 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -46,6 +46,7 @@
        "translationnotifications-deadline-label": "A label for the deadline 
field, which will have a datepicker.",
        "translationnotifications-languages-to-notify-label": "A label for 
language codes field.",
        "translationnotifications-languages-to-notify-label-help-message": 
"Used as help message for the \"Languages to notify\" textarea.\nIts label is 
{{msg-mw|Translationnotifications-languages-to-notify-label}}.",
+       "translationnotifications-sourcelang-only": "Error message shown on 
Special:NotifyTranslators.",
        "translationnotifications-priority": "A label for translation priority 
field.\n{{Identical|Priority}}",
        "translationnotifications-priority-high": "high (priority), an item in 
a dropdown box.\n{{Identical|High}}",
        "translationnotifications-priority-medium": "medium (priority), an item 
in a dropdown box.\n{{Identical|Medium}}",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I85fff2fc47b57c2e7742292c3abb199f2cbba823
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TranslationNotifications
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to