jenkins-bot has submitted this change and it was merged.
Change subject: Fixing fatal error on Special:Uploads for mobile
......................................................................
Fixing fatal error on Special:Uploads for mobile
Also moving userCanUpload() back to MobileContext, as my assumption
about it only being called from SkinMinerva was incorrect.
Bug: 68756
Change-Id: I332adc195ed3a7e3bd5970d86d2f2a76237fdeee
---
M includes/MobileContext.php
M includes/skins/SkinMinerva.php
2 files changed, 23 insertions(+), 23 deletions(-)
Approvals:
MaxSem: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index e01e4db..7ae99e2 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -144,6 +144,26 @@
}
/**
+ * Whether the user is allowed to upload
+ * @return boolean
+ */
+ public function userCanUpload() {
+ global $wgMFUploadMinEdits, $wgEnableUploads;
+ $user = $this->getUser();
+
+ if ( $wgEnableUploads ) {
+ // Make sure the user is either in desktop mode or
meets the special
+ // conditions necessary for uploading in mobile mode.
+ if ( !$this->shouldDisplayMobileView() ||
+ ( $user->isAllowed( 'mf-uploadbutton' ) &&
$user->getEditCount() >= $wgMFUploadMinEdits )
+ ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Check whether the device is a mobile device
* @return bool
*/
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 3916eb8..d80812c 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -137,26 +137,6 @@
}
/**
- * Whether the user is allowed to upload
- * @return boolean
- */
- public function userCanUpload() {
- global $wgMFUploadMinEdits, $wgEnableUploads;
- $user = $this->getUser();
-
- if ( $wgEnableUploads ) {
- // Make sure the user is either in desktop mode or
meets the special
- // conditions necessary for uploading in mobile mode.
- if ( !$this->mobileContext->shouldDisplayMobileView() ||
- ( $user->isAllowed( 'mf-uploadbutton' ) &&
$user->getEditCount() >= $wgMFUploadMinEdits )
- ) {
- return true;
- }
- }
- return false;
- }
-
- /**
* Overrides Skin::doEditSectionLink
* @param Title $nt
* @param string $section
@@ -307,7 +287,7 @@
)
);
if ( $this->isMobileMode ) {
- if ( $this->userCanUpload() ) {
+ if ( $this->mobileContext->userCanUpload() ) {
$items['uploads'] = array(
'links' => array(
array(
@@ -707,7 +687,7 @@
if (
$this->isAllowedPageAction( 'upload' )
&& !$title->isMainPage()
- && $this->userCanUpload()
+ && $this->mobileContext->userCanUpload()
) {
$menu['photo'] = array( 'id' => 'ca-upload', 'text' =>
'',
'class' => 'icon icon-32px' );
@@ -822,7 +802,7 @@
// mobile specific config variables
if ( $this->mobileContext->shouldDisplayMobileView() ) {
$vars['wgImagesDisabled'] =
$this->mobileContext->imagesDisabled();
- $vars['wgUserCanUpload'] = $this->userCanUpload();
+ $vars['wgUserCanUpload'] =
$this->mobileContext->userCanUpload();
}
return $vars;
--
To view, visit https://gerrit.wikimedia.org/r/149915
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I332adc195ed3a7e3bd5970d86d2f2a76237fdeee
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits