Minor followup to r64197
authorSam Reed <reedy@users.mediawiki.org>
Thu, 25 Mar 2010 22:31:41 +0000 (22:31 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 25 Mar 2010 22:31:41 +0000 (22:31 +0000)
Allow unwatch via ApiUpload, UploadBase doesn't allow/cater for unwatching, so use the $wgUser object to do it, rather than possibly causing a breaking change in UploadBase

includes/api/ApiUpload.php

index eabb7e2..0206744 100644 (file)
@@ -236,8 +236,13 @@ class ApiUpload extends ApiBase {
 
                        $this->dieUsage( 'An internal error occurred', 'internal-error', 0, $error );
                }
-
+               
                $file = $this->mUpload->getLocalFile();
+               
+               if ( !$watch ) {
+                       $wgUser->removeWatch( $file->getTitle() );
+               }
+               
                $result['result'] = 'Success';
                $result['filename'] = $file->getName();
                $result['imageinfo'] = $this->mUpload->getImageInfo( $this->getResult() );