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

Change subject: Accept article ID as default setting for translatable page
......................................................................


Accept article ID as default setting for translatable page

Bug: 49326
Change-Id: Icbc38d07bbdf3c02646b929df1c6eba033be35d4
---
M SpecialNotifyTranslators.php
1 file changed, 7 insertions(+), 4 deletions(-)

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



diff --git a/SpecialNotifyTranslators.php b/SpecialNotifyTranslators.php
index 62c2612..693d228 100644
--- a/SpecialNotifyTranslators.php
+++ b/SpecialNotifyTranslators.php
@@ -18,7 +18,6 @@
  *
  * @ingroup SpecialPage TranslateSpecialPage
  */
-
 class SpecialNotifyTranslators extends SpecialPage {
        public static $right = 'translate-manage';
        private $notificationText = '';
@@ -40,7 +39,9 @@
 
                $this->checkPermissions();
 
-               $htmlFormDataModel = $this->getFormFields();
+               $htmlFormDataModel = $this->getFormFields(
+                       $this->getRequest()->getInt( 'tpage' )
+               );
                $output = $this->getOutput();
 
                if ( !is_array( $htmlFormDataModel ) ) {
@@ -79,9 +80,10 @@
        /**
         * Builds the form fields
         *
+        * @param int $tpage Article ID to preselect as translatable page in 
form
         * @return array or string with an error message key in case of error
         */
-       private function getFormFields() {
+       private function getFormFields( $tpage = 0 ) {
                // Translatable pages dropdown
                $translatablePages = MessageGroups::getGroupsByType( 
'WikiPageMessageGroup' );
 
@@ -103,11 +105,12 @@
 
                $formFields = array();
 
+               $default = (int) $tpage !== 0 ? $tpage : 'unset';
                $formFields['TranslatablePage'] = array(
                        'type' => 'select',
                        'label-message' => array( 
'translationnotifications-translatablepage-title' ),
                        'options' => $translatablePagesOptions,
-                       'default' => 'unset',
+                       'default' => $default
                );
 
                // Languages to notify input box

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icbc38d07bbdf3c02646b929df1c6eba033be35d4
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/TranslationNotifications
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[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