jenkins-bot has submitted this change and it was merged.

Change subject: Use canUseWikiPage before getWikiPage
......................................................................


Use canUseWikiPage before getWikiPage

getWikiPage() creates an Exception if there is no WikiPage, so first check,
if the Page can be used as a WikiPage with canUseWikiPage().

Implemented a redirect to Main page in redirectmobileeditor if no targeturl
is in page.

Follows up: I509f7dac52b7837bf8b07a790c87f83208568e70

Bug: 68249
Change-Id: I3278b323b953bdd60f455be576adfe6fbc39d823
---
M includes/MobileFrontend.body.php
M javascripts/specials/redirectmobileeditor.js
2 files changed, 7 insertions(+), 1 deletion(-)

Approvals:
  Kaldari: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/MobileFrontend.body.php b/includes/MobileFrontend.body.php
index 17a6192..fcea67d 100644
--- a/includes/MobileFrontend.body.php
+++ b/includes/MobileFrontend.body.php
@@ -44,6 +44,7 @@
                $specialPage = $out->getTitle()->isSpecialPage();
                $formatter->enableExpandableSections(
                        $out->isArticleRelated()
+                       && $out->canUseWikiPage()
                        && $out->getWikiPage()->getContentModel() == 
CONTENT_MODEL_WIKITEXT
                );
                if ( $context->getContentTransformations() ) {
diff --git a/javascripts/specials/redirectmobileeditor.js 
b/javascripts/specials/redirectmobileeditor.js
index 7a52fc2..2b43f73 100644
--- a/javascripts/specials/redirectmobileeditor.js
+++ b/javascripts/specials/redirectmobileeditor.js
@@ -1,4 +1,9 @@
 ( function ( $ ) {
        // Redirect users with javascript to the proper editor
-       location.replace( $( '#mw-mf-editor' ).data( 'targeturl' ) );
+       var redirectTarget = $( '#mw-mf-editor' ).data( 'targeturl' );
+       if ( redirectTarget !== undefined ) {
+               location.replace( redirectTarget );
+       } else {
+               location.replace( 'index.php?title=' + mw.config.get( 
'wgMainPageTitle' ) );
+       }
 } )( jQuery );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3278b323b953bdd60f455be576adfe6fbc39d823
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: JGonera <[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

Reply via email to