jenkins-bot has submitted this change and it was merged.
Change subject: Don't redirect Flow boards to SpecialMobileHistory
......................................................................
Don't redirect Flow boards to SpecialMobileHistory
Bug: T93491
Change-Id: I2b3843d8499ffd0bfa054e2b4c94821b1e08f01b
---
M includes/MobileContext.php
M includes/specials/SpecialMobileHistory.php
2 files changed, 33 insertions(+), 2 deletions(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index 5950881..1a6bf72 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -393,12 +393,18 @@
* If a page has an equivalent but different mobile page redirect to it
*/
private function redirectMobileEnabledPages() {
+ $request = $this->getRequest();
+ $title = $this->getTitle();
+
$redirectUrl = null;
- if ( $this->getRequest()->getCheck( 'diff' ) ) {
+ if ( $request->getCheck( 'diff' ) ) {
$redirectUrl =
SpecialMobileDiff::getMobileUrlFromDesktop();
}
- if ( $this->getRequest()->getVal( 'action' ) === 'history' ) {
+ if ( $request->getVal( 'action' ) === 'history' &&
+ // check, if SpecialMobileHistory supports the history
action set for this title
+ // content model
+ SpecialMobileHistory::shouldUseSpecialHistory( $title )
) {
$values = $this->getRequest()->getValues();
// avoid infinite redirect loops
unset( $values['action'] );
diff --git a/includes/specials/SpecialMobileHistory.php
b/includes/specials/SpecialMobileHistory.php
index a3dc673..ed36a47 100644
--- a/includes/specials/SpecialMobileHistory.php
+++ b/includes/specials/SpecialMobileHistory.php
@@ -89,6 +89,24 @@
}
/**
+ * Checks, if the given title supports the use of SpecialMobileHistory.
+ *
+ * @param Title $title The title to check
+ * @return boolean True, if SpecialMobileHistory can be used, false
otherwise
+ */
+ public static function shouldUseSpecialHistory( Title $title ) {
+ $contentHandler = ContentHandler::getForTitle( $title );
+ $actionOverrides = $contentHandler->getActionOverrides();
+
+ // if history is overwritten, assume, that SpecialMobileHistory
can't handle them
+ if ( isset( $actionOverrides['history'] ) ) {
+ // and return false
+ return false;
+ }
+ return true;
+ }
+
+ /**
* Render the special page
* @param string $par parameter as subpage of specialpage
*/
@@ -104,6 +122,13 @@
// enter article history view
$this->title = Title::newFromText( $par );
if ( $this->title && $this->title->exists() ) {
+ // make sure, the content of the page supports
the default history page
+ if ( !self::shouldUseSpecialHistory(
$this->title ) ) {
+ // and if not, redirect to the default
history action
+ $out->redirect(
$this->title->getLocalUrl( array( 'action' => 'history' ) ) );
+ return;
+ }
+
$this->addModules();
$this->getOutput()->addHtml(
Html::openElement( 'div', array(
'class' => 'history content-unstyled' ) )
--
To view, visit https://gerrit.wikimedia.org/r/257642
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2b3843d8499ffd0bfa054e2b4c94821b1e08f01b
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits