X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Factions%2FWatchAction.php;h=23505c020d11cd28e6458b800ce5e74954eb09d9;hp=8f13456bc922ce5aff680eda32ecaf3b314f543d;hb=e758226c91935a1df2b6fd3ed1f18922d8bfb45b;hpb=f9d7d3b8561dab3ddfd8798a77a5b72e03ac8c2b diff --git a/includes/actions/WatchAction.php b/includes/actions/WatchAction.php index 8f13456bc9..23505c020d 100644 --- a/includes/actions/WatchAction.php +++ b/includes/actions/WatchAction.php @@ -67,7 +67,8 @@ class WatchAction extends FormAction { } public function onSuccess() { - $this->getOutput()->addWikiMsg( 'addedwatchtext', $this->getTitle()->getPrefixedText() ); + $msgKey = $this->getTitle()->isTalkPage() ? 'addedwatchtext-talk' : 'addedwatchtext'; + $this->getOutput()->addWikiMsg( $msgKey, $this->getTitle()->getPrefixedText() ); } /* Static utility methods */ @@ -82,12 +83,12 @@ class WatchAction extends FormAction { */ public static function doWatchOrUnwatch( $watch, Title $title, User $user ) { if ( $user->isLoggedIn() && - $user->isWatched( $title, WatchedItem::IGNORE_USER_RIGHTS ) != $watch + $user->isWatched( $title, User::IGNORE_USER_RIGHTS ) != $watch ) { // If the user doesn't have 'editmywatchlist', we still want to // allow them to add but not remove items via edits and such. if ( $watch ) { - return self::doWatch( $title, $user, WatchedItem::IGNORE_USER_RIGHTS ); + return self::doWatch( $title, $user, User::IGNORE_USER_RIGHTS ); } else { return self::doUnwatch( $title, $user ); } @@ -101,15 +102,16 @@ class WatchAction extends FormAction { * @since 1.22 Returns Status, $checkRights parameter added * @param Title $title Page to watch/unwatch * @param User $user User who is watching/unwatching - * @param int $checkRights Passed through to $user->addWatch() + * @param bool $checkRights Passed through to $user->addWatch() + * Pass User::CHECK_USER_RIGHTS or User::IGNORE_USER_RIGHTS. * @return Status */ - public static function doWatch( Title $title, User $user, - $checkRights = WatchedItem::CHECK_USER_RIGHTS + public static function doWatch( + Title $title, + User $user, + $checkRights = User::CHECK_USER_RIGHTS ) { - if ( $checkRights !== WatchedItem::IGNORE_USER_RIGHTS && - !$user->isAllowed( 'editmywatchlist' ) - ) { + if ( $checkRights && !$user->isAllowed( 'editmywatchlist' ) ) { return User::newFatalPermissionDeniedStatus( 'editmywatchlist' ); }