respect return value of $article->doWatch() (bug 11135)
authorAaron Schulz <aaron@users.mediawiki.org>
Mon, 4 Aug 2008 03:37:32 +0000 (03:37 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Mon, 4 Aug 2008 03:37:32 +0000 (03:37 +0000)
includes/AjaxFunctions.php

index 327dead..6d80b29 100644 (file)
@@ -187,17 +187,21 @@ function wfAjaxWatch($pagename = "", $watch = "") {
                if(!$watching) {
                        $dbw = wfGetDB(DB_MASTER);
                        $dbw->begin();
-                       $article->doWatch();
+                       $ok = $article->doWatch();
                        $dbw->commit();
                }
        } else {
                if($watching) {
                        $dbw = wfGetDB(DB_MASTER);
                        $dbw->begin();
-                       $article->doUnwatch();
+                       $ok = $article->doUnwatch();
                        $dbw->commit();
                }
        }
+       // Something stopped the change
+       if( isset($ok) && !$ok ) {
+               return '<err#>';
+       }
        if( $watch ) {
                return '<w#>'.wfMsgExt( 'addedwatchtext', array( 'parse' ), $title->getPrefixedText() );
        } else {