Mattflaschen has uploaded a new change for review.

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

Change subject: Don't show edit link if editing is not supported for content 
handler
......................................................................

Don't show edit link if editing is not supported for content handler

Bug: T134206
Change-Id: I0b16e1e03c26688461cffa70b3f4b833806c390f
---
M includes/skins/SkinMinerva.php
1 file changed, 12 insertions(+), 1 deletion(-)


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

diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index ec80170..b498261 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -24,6 +24,9 @@
        protected $mobileContext;
        /** @var bool whether the page is the user's page, i.e. User:Username */
        public $isUserPage = false;
+       /** @var ContentHandler Content handler of page */
+       public $contentHandler = null;
+
        /**
         * @var boolean Whether the language button should be included in the 
secondary
         * actions HTML on non-main pages
@@ -128,7 +131,13 @@
                // All actions disabled on main apge.
                if ( !$title->isMainPage() &&
                        in_array( $action, $this->getMFConfig()->get( 
'MinervaPageActions' ) ) ) {
-                       return true;
+
+                       if ( $action === 'edit' ) {
+                               return 
$this->contentHandler->supportsDirectEditing() &&
+                                       
$this->contentHandler->supportsDirectApiEditing();
+                       } else {
+                               return true;
+                       }
                } else {
                        return false;
                }
@@ -206,6 +215,8 @@
                $this->mobileContext = MobileContext::singleton();
                $this->isMobileMode = 
$this->mobileContext->shouldDisplayMobileView();
                $title = $this->getTitle();
+               $this->contentHandler = ContentHandler::getForTitle( $title );
+
                if ( $title->inNamespace( NS_USER ) && !$title->isSubpage() ) {
                        $pageUserId = User::idFromName( $title->getText() );
                        if ( $pageUserId ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0b16e1e03c26688461cffa70b3f4b833806c390f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to