wfProfileIn( __METHOD__ );
self::doWatch( $this->getTitle(), $this->getUser() );
wfProfileOut( __METHOD__ );
+
return true;
}
* @return Status
*/
public static function doWatchOrUnwatch( $watch, Title $title, User $user ) {
- if ( $user->isLoggedIn() && $user->isWatched( $title, WatchedItem::IGNORE_USER_RIGHTS ) != $watch ) {
+ if ( $user->isLoggedIn() &&
+ $user->isWatched( $title, WatchedItem::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::doUnwatch( $title, $user );
}
}
+
return Status::newGood();
}
* @param int $checkRights Passed through to $user->addWatch()
* @return Status
*/
- public static function doWatch( Title $title, User $user, $checkRights = WatchedItem::CHECK_USER_RIGHTS ) {
- if ( $checkRights !== WatchedItem::IGNORE_USER_RIGHTS && !$user->isAllowed( 'editmywatchlist' ) ) {
+ public static function doWatch( Title $title, User $user,
+ $checkRights = WatchedItem::CHECK_USER_RIGHTS
+ ) {
+ if ( $checkRights !== WatchedItem::IGNORE_USER_RIGHTS &&
+ !$user->isAllowed( 'editmywatchlist' )
+ ) {
return User::newFatalPermissionDeniedStatus( 'editmywatchlist' );
}
$user->addWatch( $title, $checkRights );
wfRunHooks( 'WatchArticleComplete', array( &$user, &$page ) );
}
+
return $status;
}
$user->removeWatch( $title );
wfRunHooks( 'UnwatchArticleComplete', array( &$user, &$page ) );
}
+
return $status;
}
wfProfileIn( __METHOD__ );
self::doUnwatch( $this->getTitle(), $this->getUser() );
wfProfileOut( __METHOD__ );
+
return true;
}