From 1668663e90bc0c2d5cc387df63470f00b715ec78 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 4 Aug 2008 03:37:32 +0000 Subject: [PATCH] respect return value of $article->doWatch() (bug 11135) --- includes/AjaxFunctions.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/AjaxFunctions.php b/includes/AjaxFunctions.php index 327dead51f..6d80b29eb8 100644 --- a/includes/AjaxFunctions.php +++ b/includes/AjaxFunctions.php @@ -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 ''; + } if( $watch ) { return ''.wfMsgExt( 'addedwatchtext', array( 'parse' ), $title->getPrefixedText() ); } else { -- 2.20.1