From c089260cd7170c21299e7c7df269f3f01786e723 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 26 Jan 2008 00:54:50 +0000 Subject: [PATCH] Revert r30162 for now. A problem with this is that it *un*watches a previously watched image under the following circumstances: * 'watch pages I edit' is not enabled (eg, default state) * go to Special:Upload and select the file * hit 'upload' The initial check state is unchecked (since there was no initial destination name set), and this doesn't get updated to reflect the existing watch state of the previous image. There are a couple possible ways around this. One is to compare the form's actual initial check state with the submitted check state and only apply an unwatch if there was a difference. Another might be to do a watch state update via AJAX when a new destination filename is set in the form. This would allow the checkmark's default state to be set 'properly' for those with JS enabled in modern browsers. Perhaps a combination should be used. --- includes/SpecialUpload.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index ed851be2b1..657a1a5d8e 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -552,15 +552,10 @@ 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 ) ); @@ -1015,8 +1010,7 @@ wgAjaxLicensePreview = {$alp}; $watchChecked = ( $wgUser->getOption( 'watchdefault' ) || - ( $wgUser->getOption( 'watchcreations' ) && $this->mDesiredDestName == '' ) || - ( isset( $title ) && $title->userIsWatching() ) ) + ( $wgUser->getOption( 'watchcreations' ) && $this->mDesiredDestName == '' ) ) ? 'checked="checked"' : ''; $warningChecked = $this->mIgnoreWarning ? 'checked' : ''; -- 2.20.1