jenkins-bot has submitted this change and it was merged.
Change subject: Allow showing of other users uploads
......................................................................
Allow showing of other users uploads
Going to Special:Uploads/XYZ will now show user XYZ's uploads
Change-Id: Iee733bf866f9495ba32780247ce067199ec8221e
---
M MobileFrontend.i18n.php
M includes/Resources.php
M includes/specials/SpecialUploads.php
M javascripts/specials/uploads.js
4 files changed, 24 insertions(+), 9 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php
index 2a6b3e4..a920186 100644
--- a/MobileFrontend.i18n.php
+++ b/MobileFrontend.i18n.php
@@ -145,6 +145,7 @@
'mobile-frontend-nearby-directions' => 'Navigate here',
// image donation
+ 'mobile-frontend-donate-image-nouploads' => 'No uploads.',
'mobile-frontend-donate-image-login' => 'You must be logged in to see
your uploads.',
'mobile-frontend-photo-upload-disabled' => 'No image is needed on this
page.',
'mobile-frontend-photo-upload-anon' => 'You need to be logged in to add
an image to this page.',
@@ -541,6 +542,7 @@
'mobile-frontend-nearby-error-guidance' => 'Message explaining actions
user can take when keying error {{msg-mw|mobile-frontend-nearby-error}}',
'mobile-frontend-nearby-link' => 'Text of link that takes user to full
page',
'mobile-frontend-nearby-directions' => 'Text of directions link',
+ 'mobile-frontend-donate-image-nouploads' => 'Message that shows on
uploads page when a user that is not the existing user has not uploaded any
images.',
'mobile-frontend-donate-image-login' => 'Title for
[[Special:UserLogin]] when being redirected to [[Special:Uploads]].
Used when the user is not logged in.
diff --git a/includes/Resources.php b/includes/Resources.php
index 9de7d80..0f404a2 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -695,6 +695,7 @@
'mobile-frontend-first-upload-wizard-new-page-3-header',
'mobile-frontend-first-upload-wizard-new-page-3',
'mobile-frontend-first-upload-wizard-new-page-3-ok',
+ 'mobile-frontend-donate-image-nouploads',
),
'scripts' => array(
'javascripts/widgets/carousel.js',
diff --git a/includes/specials/SpecialUploads.php
b/includes/specials/SpecialUploads.php
index 266f62c..fdb0970 100644
--- a/includes/specials/SpecialUploads.php
+++ b/includes/specials/SpecialUploads.php
@@ -8,7 +8,7 @@
public function execute( $par = '' ) {
global $wgMFPhotoUploadEndpoint;
- $user = $this->getUser();
+ $user = $par ? User::newFromName( $par ) : $this->getUser();
$this->setHeaders();
$output = $this->getOutput();
diff --git a/javascripts/specials/uploads.js b/javascripts/specials/uploads.js
index 16791f0..dd542ac 100644
--- a/javascripts/specials/uploads.js
+++ b/javascripts/specials/uploads.js
@@ -6,7 +6,9 @@
View = M.require( 'view' ),
CarouselOverlay = M.require( 'overlays/CarouselOverlay' ),
corsUrl = mw.config.get( 'wgMFPhotoUploadEndpoint' ),
- userName = mw.config.get( 'wgUserName' ),
+ pageParams = mw.config.get( 'wgPageName' ).split( '/' ),
+ currentUserName = mw.config.get( 'wgUserName' ),
+ userName = pageParams[1] ? pageParams[1] : currentUserName,
IMAGE_WIDTH = 320,
UserGalleryApi, PhotoItem, PhotoList;
@@ -88,6 +90,10 @@
isEmpty: function() {
return this.$list.find( 'li' ).length === 0;
},
+ showEmptyMessage: function() {
+ $( '<p class="content">' ).text( mw.msg(
'mobile-frontend-donate-image-nouploads' ) ).
+ insertBefore( this.$list );
+ },
prependPhoto: function( photoData ) {
new PhotoItem( photoData ).prependTo( this.$list );
},
@@ -152,11 +158,11 @@
}
function init() {
- var $container, userGallery;
+ var $container, userGallery, emptyHandler;
- userGallery = new PhotoList().
- appendTo( '#content' ).
- on( 'empty', function() {
+ userGallery = new PhotoList().appendTo( '#content' );
+ if ( currentUserName === userName ) {
+ emptyHandler = function() {
new CarouselOverlay( {
pages: [
{
@@ -175,10 +181,16 @@
className:
'slide-image', id: 3
}
]
- } ).show();
- } );
+ } );
+ };
+ } else {
+ emptyHandler = function() {
+ userGallery.showEmptyMessage();
+ };
+ }
+ userGallery.on( 'empty', emptyHandler );
- if ( PhotoUploaderButton.isSupported ) {
+ if ( PhotoUploaderButton.isSupported && currentUserName ===
userName ) {
$container = $( '.ctaUploadPhoto' );
new PhotoUploaderButton( {
--
To view, visit https://gerrit.wikimedia.org/r/79080
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iee733bf866f9495ba32780247ce067199ec8221e
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits