Merge "Fix the (un)watch token to include the namespace name."
[lhc/web/wiklou.git] / includes / actions / WatchAction.php
index 3b3ae1d..8c9a46a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Performs the watch and unwatch actions on a page
+ * Performs the watch actions on a page
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -82,17 +82,10 @@ class WatchAction extends FormAction {
        protected function checkCanExecute( User $user ) {
                // Must be logged in
                if ( $user->isAnon() ) {
-                       $loginreqlink = Linker::linkKnown(
-                               SpecialPage::getTitleFor( 'Userlogin' ),
-                               $this->msg( 'loginreqlink' )->escaped(),
-                               array(),
-                               array( 'returnto' => $this->getPageTitle(), 'returntoquery' => 'action=' . $this->getName() )
-                       );
-                       $reasonMsg = $this->msg( 'watchlistanontext' )->rawParams( $loginreqlink );
-                       throw new UserNotLoggedIn( $reasonMsg, 'watchnologin' );
+                       throw new UserNotLoggedIn( 'watchlistanontext', 'watchnologin' );
                }
 
-               return parent::checkCanExecute( $user );
+               parent::checkCanExecute( $user );
        }
 
        /**
@@ -217,39 +210,3 @@ class WatchAction extends FormAction {
                $this->getOutput()->addWikiMsg( 'addedwatchtext', $this->getTitle()->getPrefixedText() );
        }
 }
-
-/**
- * Page removal from a user's watchlist
- *
- * @ingroup Actions
- */
-class UnwatchAction extends WatchAction {
-
-       public function getName() {
-               return 'unwatch';
-       }
-
-       protected function getDescription() {
-               return $this->msg( 'removewatch' )->escaped();
-       }
-
-       public function onSubmit( $data ) {
-               wfProfileIn( __METHOD__ );
-               self::doUnwatch( $this->getTitle(), $this->getUser() );
-               wfProfileOut( __METHOD__ );
-
-               return true;
-       }
-
-       protected function alterForm( HTMLForm $form ) {
-               $form->setSubmitTextMsg( 'confirm-unwatch-button' );
-       }
-
-       protected function preText() {
-               return $this->msg( 'confirm-unwatch-top' )->parse();
-       }
-
-       public function onSuccess() {
-               $this->getOutput()->addWikiMsg( 'removedwatchtext', $this->getTitle()->getPrefixedText() );
-       }
-}