01tonythomas has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/303984

Change subject: Make action=edit in a Newsletter namespace invoke 
Special:Newsletter
......................................................................

Make action=edit in a Newsletter namespace invoke Special:Newsletter

Bug: T138462
Change-Id: Ibf2b6835d4427ed29c556573fb52ff593623950e
---
M Newsletter.hooks.php
M extension.json
M includes/specials/SpecialNewsletterCreate.php
3 files changed, 27 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/84/303984/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index c4853e6..5f63b7f 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -128,4 +128,12 @@
 
                return true;
        }
+
+       public static function onCustomEditor( Article $article, User $user ) {
+               global $wgOut;
+
+               $query = "newsletter=" . $article->getTitle()->getText();
+               $title = SpecialPage::getTitleFor( 'CreateNewsletter' 
)->getFullURL($query);
+               $wgOut->redirect( $title );
+       }
 }
diff --git a/extension.json b/extension.json
index f6959e5..5abad1b 100644
--- a/extension.json
+++ b/extension.json
@@ -143,7 +143,23 @@
                ],
                "UserMergeAccountFields": [
                        "NewsletterHooks::onUserMergeAccountFields"
+               ],
+               "CustomEditor": [
+                       "NewsletterHooks::onCustomEditor"
                ]
        },
+       "namespaces": [
+               {
+                       "id": 5500,
+                       "constant": "NS_NEWSLETTER",
+                       "name": "Newsletter",
+                       "protection": "newsletter-create"
+               },
+               {
+                       "id": 5501,
+                       "constant": "NS_NEWSLETTER_TALK",
+                       "name": "Newsletter_talk"
+               }
+       ],
        "manifest_version": 1
 }
diff --git a/includes/specials/SpecialNewsletterCreate.php 
b/includes/specials/SpecialNewsletterCreate.php
index afd6e54..565ef20 100644
--- a/includes/specials/SpecialNewsletterCreate.php
+++ b/includes/specials/SpecialNewsletterCreate.php
@@ -39,12 +39,14 @@
         * @return array
         */
        protected function getFormFields() {
+               $newsletterName = $this->getRequest()->getVal( 'newsletter' ) ? 
: '';
                return array(
                        'name' => array(
                                'type' => 'text',
                                'required' => true,
                                'label-message' => 'newsletter-name',
-                               'maxlength' => 120
+                               'maxlength' => 120,
+                               'default' => $newsletterName
                        ),
                        'mainpage' => array(
                                'type' => 'title',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf2b6835d4427ed29c556573fb52ff593623950e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <[email protected]>

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

Reply via email to