From: addshore Date: Thu, 7 Aug 2014 00:40:35 +0000 (+0100) Subject: Split UnwatchAction into own class X-Git-Tag: 1.31.0-rc.0~14548 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=3263900481a716913fbd2b59ae855416dc3dfac4;p=lhc%2Fweb%2Fwiklou.git Split UnwatchAction into own class Change-Id: Ief650c115237214345bef7733d33967f0e042521 --- diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index d7dda6f4bb..b84feb20c4 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -217,7 +217,7 @@ $wgAutoloadLocalClasses = array( 'RollbackAction' => 'includes/actions/RollbackAction.php', 'SubmitAction' => 'includes/actions/EditAction.php', 'UnprotectAction' => 'includes/actions/UnprotectAction.php', - 'UnwatchAction' => 'includes/actions/WatchAction.php', + 'UnwatchAction' => 'includes/actions/UnwatchAction.php', 'ViewAction' => 'includes/actions/ViewAction.php', 'WatchAction' => 'includes/actions/WatchAction.php', diff --git a/includes/actions/UnwatchAction.php b/includes/actions/UnwatchAction.php new file mode 100644 index 0000000000..e2e5a1d843 --- /dev/null +++ b/includes/actions/UnwatchAction.php @@ -0,0 +1,57 @@ +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() ); + } +} diff --git a/includes/actions/WatchAction.php b/includes/actions/WatchAction.php index 2c7502e574..a54b7c57cd 100644 --- a/includes/actions/WatchAction.php +++ b/includes/actions/WatchAction.php @@ -1,6 +1,6 @@ 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() ); - } -}