Merge "Add .pipeline/ with dev image variant"
[lhc/web/wiklou.git] / includes / actions / WatchAction.php
index aaccc0c..e88654a 100644 (file)
@@ -20,6 +20,8 @@
  * @ingroup Actions
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * Page addition to a user's watchlist
  *
@@ -116,7 +118,8 @@ class WatchAction extends FormAction {
                User $user,
                $checkRights = User::CHECK_USER_RIGHTS
        ) {
-               if ( $checkRights && !$user->isAllowed( 'editmywatchlist' ) ) {
+               $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
+               if ( $checkRights && !$permissionManager->userHasRight( $user, 'editmywatchlist' ) ) {
                        return User::newFatalPermissionDeniedStatus( 'editmywatchlist' );
                }
 
@@ -140,7 +143,9 @@ class WatchAction extends FormAction {
         * @return Status
         */
        public static function doUnwatch( Title $title, User $user ) {
-               if ( !$user->isAllowed( 'editmywatchlist' ) ) {
+               if ( !MediaWikiServices::getInstance()
+                       ->getPermissionManager()
+                       ->userHasRight( $user, 'editmywatchlist' ) ) {
                        return User::newFatalPermissionDeniedStatus( 'editmywatchlist' );
                }
 
@@ -173,21 +178,6 @@ class WatchAction extends FormAction {
                return $user->getEditToken( $action );
        }
 
-       /**
-        * Get token to unwatch (or watch) a page for a user
-        *
-        * @param Title $title Title object of page to unwatch
-        * @param User $user User for whom the action is going to be performed
-        * @param string $action Optionally override the action to 'watch'
-        * @return string Token
-        * @since 1.18
-        * @deprecated since 1.32 Use WatchAction::getWatchToken() with action 'unwatch' directly.
-        */
-       public static function getUnwatchToken( Title $title, User $user, $action = 'unwatch' ) {
-               wfDeprecated( __METHOD__, '1.32' );
-               return self::getWatchToken( $title, $user, $action );
-       }
-
        public function doesWrites() {
                return true;
        }