From 28f7bf1f2bef920cc99c9807fb252c180c16c40a Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 24 Feb 2011 16:00:06 +0000 Subject: [PATCH] Followup r82727, improve comments, cast return value to bool --- includes/Article.php | 3 +++ includes/api/ApiBase.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 1d8f68bd2c..9512ce1f18 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2431,6 +2431,9 @@ class Article { /** * Add this page to $wgUser's watchlist + * + * This is safe to be called multiple times + * * @return bool true on successful watch operation */ public function doWatch() { diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index bd6f74e5f6..e761fbd246 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -602,8 +602,8 @@ abstract class ApiBase { $userOption = $titleObj->exists() ? 'watchdefault' : 'watchcreations'; } - # If the corresponding user option is true, watch, don't - return $wgUser->getOption( $userOption ) ? true : false; + # Watch the article based on the user preference + return (bool)$wgUser->getOption( $userOption ); case 'nochange': return $userWatching; -- 2.20.1