Sumit has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/257588

Change subject: MobileFrontend allow anons to see per user uploads
......................................................................

MobileFrontend allow anons to see per user uploads

Removes the need to login for anons to see urls of the form
Special:Uploads/username, i.e., per user uploads.

Bug: T109894
Change-Id: Ie927242f805ba86d53f86a369b2209e12c27c0e1
---
M includes/specials/SpecialUploads.php
1 file changed, 25 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/88/257588/1

diff --git a/includes/specials/SpecialUploads.php 
b/includes/specials/SpecialUploads.php
index 733a455..16dc416 100644
--- a/includes/specials/SpecialUploads.php
+++ b/includes/specials/SpecialUploads.php
@@ -21,34 +21,36 @@
         * @param string|null $par Username to get uploads from
         */
        public function executeWhenAvailable( $par = '' ) {
-               // Anons don't get to see this page
-               $this->requireLogin( 'mobile-frontend-donate-image-anon' );
+               if ( ( $par === '' || $par === null ) && 
$this->getUser()->isAnon() ) {
+                       // Anons don't get to see this page
+                       $this->requireLogin( 
'mobile-frontend-donate-image-anon' );
+               } else {
+                       $this->setHeaders();
+                       $output = $this->getOutput();
+                       $output->addJsConfigVars(
+                               'wgMFPhotoUploadEndpoint',
+                               $this->getMFConfig()->get( 
'MFPhotoUploadEndpoint' )
+                       );
+                       $output->setPageTitle( $this->msg( 
'mobile-frontend-donate-image-title' ) );
 
-               $this->setHeaders();
-               $output = $this->getOutput();
-               $output->addJsConfigVars(
-                       'wgMFPhotoUploadEndpoint',
-                       $this->getMFConfig()->get( 'MFPhotoUploadEndpoint' )
-               );
-               $output->setPageTitle( $this->msg( 
'mobile-frontend-donate-image-title' ) );
-
-               if ( $par !== '' && $par !== null ) {
-                       $user = User::newFromName( $par );
-                       if ( !$user || $user->isAnon() ) {
-                               $output->setStatusCode( 404 );
-                               $html = MobileUI::contentElement(
-                                       MobileUI::errorBox(
-                                               $this->msg( 
'mobile-frontend-photo-upload-invalid-user', $par )->parse() )
-                               );
+                       if ( $par !== '' && $par !== null ) {
+                               $user = User::newFromName( $par );
+                               if ( !$user || $user->isAnon() ) {
+                                       $output->setStatusCode( 404 );
+                                       $html = MobileUI::contentElement(
+                                               MobileUI::errorBox(
+                                                       $this->msg( 
'mobile-frontend-photo-upload-invalid-user', $par )->parse() )
+                                       );
+                               } else {
+                                       $html = $this->getUserUploadsPageHtml( 
$user );
+                               }
                        } else {
+                               $user = $this->getUser();
+                               // TODO: what if the user cannot upload to the 
destination wiki in $wgMFPhotoUploadEndpoint?
                                $html = $this->getUserUploadsPageHtml( $user );
                        }
-               } else {
-                       $user = $this->getUser();
-                       // TODO: what if the user cannot upload to the 
destination wiki in $wgMFPhotoUploadEndpoint?
-                       $html = $this->getUserUploadsPageHtml( $user );
+                       $output->addHTML( $html );
                }
-               $output->addHTML( $html );
        }
        /**
         * Generates HTML for the uploads page for the passed user.

-- 
To view, visit https://gerrit.wikimedia.org/r/257588
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie927242f805ba86d53f86a369b2209e12c27c0e1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Sumit <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to