Followup r82727, improve comments, cast return value to bool
authorSam Reed <reedy@users.mediawiki.org>
Thu, 24 Feb 2011 16:00:06 +0000 (16:00 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 24 Feb 2011 16:00:06 +0000 (16:00 +0000)
includes/Article.php
includes/api/ApiBase.php

index 1d8f68b..9512ce1 100644 (file)
@@ -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() {
index bd6f74e..e761fbd 100644 (file)
@@ -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;