JGonera has uploaded a new change for review.
https://gerrit.wikimedia.org/r/50939
Change subject: Disable photo upload button on main and protected pages
......................................................................
Disable photo upload button on main and protected pages
Change-Id: Ia7236a76a18c81289a72515ed80629566eb5cee5
---
M javascripts/modules/mf-photo.js
M tests/js/test_mf-photo.js
2 files changed, 5 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/39/50939/1
diff --git a/javascripts/modules/mf-photo.js b/javascripts/modules/mf-photo.js
index 4f9ceb2..31f2418 100644
--- a/javascripts/modules/mf-photo.js
+++ b/javascripts/modules/mf-photo.js
@@ -17,7 +17,7 @@
$container = $content_0;
}
- return $container.find( '.thumb img, .navbox, .infobox'
).length === 0;
+ return $container.find( 'img, .navbox, .infobox' ).length === 0;
}
function isSupported() {
@@ -432,7 +432,7 @@
} );
}
- if ( isSupported() ) {
+ if ( isSupported() && M.getConfig( 'can_edit' ) ) {
// FIXME: https://bugzilla.wikimedia.org/show_bug.cgi?id=45299
if ( M.getConfig( 'beta' ) ) {
M.on( 'page-loaded', initialize );
diff --git a/tests/js/test_mf-photo.js b/tests/js/test_mf-photo.js
index 69a5a89..05aec3a 100644
--- a/tests/js/test_mf-photo.js
+++ b/tests/js/test_mf-photo.js
@@ -21,7 +21,9 @@
// no #content_0 and an infobox
[ $( '<div><table class="infobox"><div>' ), false ],
// no #content_0 and a navbox
- [ $( '<div><table class="navbox"><div>' ), false ]
+ [ $( '<div><table class="navbox"><div>' ), false ],
+ // no #content_0, image not in .thumb (happens on main pages)
+ [ $( '<div><img><div>' ), false ]
];
module( 'MobileFrontend photo', {
--
To view, visit https://gerrit.wikimedia.org/r/50939
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7236a76a18c81289a72515ed80629566eb5cee5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: JGonera <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits