jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/328023 )

Change subject: Removed usage of old SpecialPage code for viewing the page
......................................................................


Removed usage of old SpecialPage code for viewing the page

Bug: T152678
Change-Id: Ic725e3767c213fe304063681b411dfe5da86143a
---
M i18n/en.json
M i18n/qqq.json
M includes/specials/SpecialNewsletter.php
3 files changed, 3 insertions(+), 132 deletions(-)

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



diff --git a/i18n/en.json b/i18n/en.json
index b94d4f5..21a59d1 100755
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -33,7 +33,6 @@
        "newsletter-subscribe-loginrequired": "Please log in to subscribe to 
[[Special:Newsletters|newsletters]].",
        "newsletter-notfound": "Newsletter not found",
        "newsletter-not-found-id": "A newsletter with this ID does not exist. A 
[[Special:Newsletters|list of existing newsletters]] is available.",
-       "newsletter-view": "View newsletter details",
        "newsletter-view-mainpage": "Main page:",
        "newsletter-view-description": "Description:",
        "newsletter-view-publishers": "{{PLURAL:$1|Publisher:|Publishers:}}",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index c419efb..6e2da62 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -40,7 +40,6 @@
        "newsletter-subscribe-loginrequired": "Error message shown on the login 
form for non-logged in users if they try to visit 
Special:Newsletter/<id>/subscribe.",
        "newsletter-notfound": "Header of Special:Newsletter/<id> if no 
newsletter by that id exists.\n\nSee also:\n* 
{{msg-mw|newsletter-not-found-id}}",
        "newsletter-not-found-id": "Error message shown on 
Special:Newsletter/<id> if no newsletter by that id exists.\n\nSee also:\n* 
{{msg-mw|newsletter-notfound}}",
-       "newsletter-view": "Header message shown on Special:Newsletter/<id> if 
a newsletter by the specified id exists.\n\nSee also:\n* 
{{msg-mw|newsletter-delete}}",
        "newsletter-view-mainpage": "Label for the newsletter's main page 
field. Shown on Special:Newsletter/<id>\n{{Identical|Main page}}",
        "newsletter-view-description": "Label for newsletter description field. 
Shown on Special:Newsletter/<id>\n{{Identical|Description}}",
        "newsletter-view-publishers": "Label for newsletter's publisher(s) 
field. Shown on Special:Newsletter/<id>.\n\nParameters:\n* $1 - Number of 
publishers for the newsletter, for use with PLURAL.",
diff --git a/includes/specials/SpecialNewsletter.php 
b/includes/specials/SpecialNewsletter.php
index dc5a760..11b7039 100644
--- a/includes/specials/SpecialNewsletter.php
+++ b/includes/specials/SpecialNewsletter.php
@@ -61,9 +61,9 @@
                                        $this->doAnnounceExecute();
                                        break;
                                default:
-                                       $this->doViewExecute();
-                                       $action = null;
-                                       break;
+                                       $this->getOutput()->redirect(
+                                               Title::makeTitleSafe( 
NS_NEWSLETTER, $this->newsletter->getName() )->getFullURL() );
+                                       return;
                        }
 
                        $out->addSubtitle( $this->getNavigationLinks( $action ) 
);
@@ -181,94 +181,6 @@
        }
 
        /**
-        * Build the main form for Special:Newsletter/$id. This is shown
-        * by default when visiting Special:Newsletter/$id
-        */
-       protected function doViewExecute() {
-               $user = $this->getUser();
-               $this->getOutput()->setPageTitle( $this->msg( 'newsletter-view' 
) );
-
-               if ( $user->isLoggedIn() ) {
-                       // buttons are only shown for logged-in users
-                        $html = $this->getNewsletterActionButtons();
-                        $this->getOutput()->addHTML( $html );
-               }
-
-               $publishers = UserArray::newFromIDs( 
$this->newsletter->getPublishers() );
-               $mainTitle = Title::newFromID( $this->newsletter->getPageId() );
-               $fields = array(
-                       'mainpage' => array(
-                               'type' => 'info',
-                               'label-message' => 'newsletter-view-mainpage',
-                               'default' => 
$this->getLinkRenderer()->makeLink( $mainTitle, $mainTitle->getPrefixedText() ),
-                               'raw' => true,
-                       ),
-                       'description' => array(
-                               'type' => 'info',
-                               'label-message' => 
'newsletter-view-description',
-                               'default' => 
$this->newsletter->getDescription(),
-                               'rows' => 6,
-                               'readonly' => true,
-                       ),
-                       'publishers' => array(
-                               'type' => 'info',
-                               'label' => $this->msg( 
'newsletter-view-publishers' )
-                                       ->numParams( count( $publishers ) )
-                                       ->text(),
-                       ),
-                       'subscribe' => array(
-                               'type' => 'info',
-                               'label-message' => 
'newsletter-view-subscriber-count',
-                               'default' => $this->getLanguage()->formatNum( 
$this->newsletter->getSubscriberCount() ),
-                       ),
-               );
-
-               if ( count( $publishers ) > 0 ) {
-                       // Have this here to avoid calling unneeded functions
-                       $this->doLinkCacheQuery( $publishers );
-                       $fields['publishers']['default'] = 
$this->buildUserList( $publishers );
-                       $fields['publishers']['raw'] = true;
-               } else {
-                       // Show a message if there are no publishers instead of 
nothing
-                       $fields['publishers']['default'] = $this->msg( 
'newsletter-view-no-publishers' )->escaped();
-               }
-
-               // Show the 10 most recent issues if there have been 
announcements
-               $logs = '';
-               $logCount = LogEventsList::showLogExtract(
-                       $logs, // by reference
-                       'newsletter',
-                       $this->getPageTitle( $this->newsletter->getId() ),
-                       '',
-                       array(
-                               'lim' => 10,
-                               'showIfEmpty' => false,
-                               'conds' => array( 'log_action' => 'issue-added' 
),
-                               'extraUrlParams' => array( 'subtype' => 
'issue-added' ),
-                       )
-               );
-
-               if ( $logCount !== 0 ) {
-                       $fields['issues'] = array(
-                               'type' => 'info',
-                               'raw' => true,
-                               'default' => $logs,
-                               'label' => $this->msg( 
'newsletter-view-issues-log' )->numParams( $logCount )->text(),
-                       );
-               }
-
-               $form = $this->getHTMLForm(
-                       $fields,
-                       function() {
-                               return false;
-                       } // nothing to submit - the buttons on this page are 
just links
-               );
-
-               $form->suppressDefaultSubmit();
-               $form->show();
-       }
-
-       /**
         * Build a group of buttons: Manage, Subscribe|Unsubscribe
         * Buttons will be showed to the user only if they are relevant to the 
current user.
         *
@@ -320,45 +232,6 @@
 
                $widget = new OOUI\ButtonGroupWidget( array( 'items' =>  
$buttons ) );
                return $widget->toString();
-       }
-
-       /**
-        * Batch query to determine whether user pages and user talk pages exist
-        * or not and add them to LinkCache
-        *
-        * @param Iterator $users
-        *
-        * @return string
-        */
-       private function doLinkCacheQuery( Iterator $users ) {
-               $batch = new LinkBatch();
-               foreach ( $users as $user ) {
-                       $batch->addObj( $user->getUserPage() );
-                       $batch->addObj( $user->getTalkPage() );
-               }
-
-               $batch->execute();
-       }
-
-       /**
-        * Get a list of users with user-related links next to each username
-        *
-        * @param Iterator $users
-        *
-        * @return string
-        */
-       private function buildUserList( Iterator $users ) {
-               $str = '';
-               foreach ( $users as $user ) {
-                       $str .= Html::rawElement(
-                               'li',
-                               array(),
-                               Linker::userLink( $user->getId(), 
$user->getName() ) .
-                               Linker::userToolLinks( $user->getId(), 
$user->getName() )
-                       );
-               }
-
-               return Html::rawElement( 'ul', array(), $str );
        }
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic725e3767c213fe304063681b411dfe5da86143a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: Georggi199 <bmp2...@gmail.com>
Gerrit-Reviewer: 01tonythomas <01tonytho...@gmail.com>
Gerrit-Reviewer: MtDu <justin.d...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to