Chad has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/357942 )
Change subject: Ensure mDiffEngine is always available
......................................................................
Ensure mDiffEngine is always available
The methods have been renamed to make it clearer what the purpose
of these methods are.
They are also made private to make it clear they should not be
used out of context.
addMobileDiff should only be called if InlineDifferenceEngine is
used as getWarningMessageText is not a method of DifferenceEngine
This is a follow up to
I68cf50f5dd339f34802d70df1f32d2c3390944a3
Bug: T167461
Change-Id: Ia59d76769960630859c9666acc5a28317e9272b7
(cherry picked from commit 833d3f555544f796b09016f15dc63e9361908f99)
---
M includes/specials/SpecialMobileDiff.php
1 file changed, 19 insertions(+), 16 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/42/357942/1
diff --git a/includes/specials/SpecialMobileDiff.php
b/includes/specials/SpecialMobileDiff.php
index 1933dd8..89521a5 100644
--- a/includes/specials/SpecialMobileDiff.php
+++ b/includes/specials/SpecialMobileDiff.php
@@ -133,9 +133,7 @@
$output->addHtml( '<div id="mw-mf-diffview"
class="content-unstyled"><div id="mw-mf-diffarea">' );
- $this->setupDifferenceEngine();
- $this->showHeader();
- $this->showDiff();
+ $this->displayMobileDiff();
$output->addHtml( '</div>' );
$this->showFooter( $ctx );
@@ -155,15 +153,16 @@
}
/**
- * Setups the DifferenceEngine.
+ * Setups the mobile DifferenceEngine and displays a mobile optimised
diff.
*/
- protected function setupDifferenceEngine() {
+ protected function displayMobileDiff() {
+ $useMobileMode = false;
$contentHandler = $this->rev->getContentHandler();
- $de = $contentHandler->createDifferenceEngine(
$this->getContext(), $this->getPrevId(),
- $this->revId );
- // HACK:
- if ( get_class( $de ) == 'DifferenceEngine' ) {
- $de = new $this->diffClass(
+ $this->mDiffEngine = $contentHandler->createDifferenceEngine(
$this->getContext(),
+ $this->getPrevId(), $this->revId );
+
+ if ( get_class( $this->mDiffEngine ) == 'DifferenceEngine' ) {
+ $this->mDiffEngine = new $this->diffClass(
$this->getContext(),
$this->getPrevId(),
$this->revId,
@@ -171,11 +170,15 @@
false,
(bool)$this->getRequest()->getVal( 'unhide' )
);
- } else {
- $de->showDiffPage();
- return;
+ $useMobileMode = true;
}
- $this->mDiffEngine = $de;
+
+ $this->showHeader();
+ if ( $useMobileMode ) {
+ $this->addMobileDiff();
+ } else {
+ $this->mDiffEngine->showDiffPage();
+ }
}
/**
@@ -185,7 +188,7 @@
* Day and time of edit
* Edit Comment
*/
- function showHeader() {
+ private function showHeader() {
$title = $this->targetTitle;
if ( $this->prevRev ) {
@@ -257,7 +260,7 @@
* Render the inline difference between two revisions
* using InlineDiffEngine
*/
- function showDiff() {
+ private function addMobileDiff() {
$output = $this->getOutput();
$prevId = $this->getPrevId();
--
To view, visit https://gerrit.wikimedia.org/r/357942
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia59d76769960630859c9666acc5a28317e9272b7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: wmf/1.30.0-wmf.4
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits