From f5c5abd1eade5be126b5aa97f4a66dae21c791c8 Mon Sep 17 00:00:00 2001 From: Robert Leverington Date: Sat, 26 Jan 2008 00:37:42 +0000 Subject: [PATCH] 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. --- includes/SpecialUpload.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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' : ''; -- 2.20.1