From: Robert Leverington Date: Sat, 26 Jan 2008 00:37:42 +0000 (+0000) Subject: Fix bug 9246 by watching a page when the upload\reupload "Watch this page" checkbox... X-Git-Tag: 1.31.0-rc.0~49771 X-Git-Url: http://git.cyclocoop.org/%22.htmlspecialchars%28%24url_syndic%29.%22?a=commitdiff_plain;h=f5c5abd1eade5be126b5aa97f4a66dae21c791c8;p=lhc%2Fweb%2Fwiklou.git Fix bug 9246 by watching a page when the upload\reupload "Watch this page" checkbox is checked and unwatching a page when it is not. --- diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 657a1a5d8e..ed851be2b1 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -552,10 +552,15 @@ class UploadForm { $resultDetails = array( 'internal' => $status->getWikiText() ); return self::INTERNAL_ERROR; } else { + + // Check if "Watch this page" is checked or not and process. + global $wgUser; if ( $this->mWatchthis ) { - global $wgUser; $wgUser->addWatch( $this->mLocalFile->getTitle() ); + } else { + $wgUser->removeWatch( $this->mLocalFile->getTitle() ); } + // Success, redirect to description page $img = null; // @todo: added to avoid passing a ref to null - should this be defined somewhere? wfRunHooks( 'UploadComplete', array( &$img ) ); @@ -1010,7 +1015,8 @@ wgAjaxLicensePreview = {$alp}; $watchChecked = ( $wgUser->getOption( 'watchdefault' ) || - ( $wgUser->getOption( 'watchcreations' ) && $this->mDesiredDestName == '' ) ) + ( $wgUser->getOption( 'watchcreations' ) && $this->mDesiredDestName == '' ) || + ( isset( $title ) && $title->userIsWatching() ) ) ? 'checked="checked"' : ''; $warningChecked = $this->mIgnoreWarning ? 'checked' : '';