Thiemo Mättig (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/394973 )
Change subject: Never show edit section links in entity diffs
......................................................................
Never show edit section links in entity diffs
Bug: T181807
Change-Id: Iad4f8f8458a4d4d38b4874df86191c30f2ac5229
---
M repo/includes/Actions/ViewEntityAction.php
M repo/includes/Diff/EntityContentDiffView.php
2 files changed, 11 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/73/394973/1
diff --git a/repo/includes/Actions/ViewEntityAction.php
b/repo/includes/Actions/ViewEntityAction.php
index 88946ce..6bb538f 100644
--- a/repo/includes/Actions/ViewEntityAction.php
+++ b/repo/includes/Actions/ViewEntityAction.php
@@ -54,15 +54,13 @@
}
/**
- * Returns true if this view action is performing a plain view (not a
diff, print version, etc.)
- * of the page's current revision.
- *
- * @return bool
+ * @return bool False for older revisions, or if this is for sure not a
plain view (e.g. diff or
+ * print view).
*/
private function isEditable() {
- return !$this->isDiff()
- && !$this->getOutput()->isPrintable()
- && $this->page->isCurrent();
+ return $this->page->isCurrent()
+ && !$this->isDiff()
+ && !$this->getOutput()->isPrintable();
}
/**
@@ -74,10 +72,9 @@
private function showEntityPage() {
$outputPage = $this->getOutput();
- $editable = $this->isEditable();
// NOTE: page-wide property, independent of user permissions
- $outputPage->addJsConfigVars( 'wbIsEditView', $editable );
+ $outputPage->addJsConfigVars( 'wbIsEditView',
$this->isEditable() );
$this->page->view();
$this->overridePageMetaTags( $outputPage );
diff --git a/repo/includes/Diff/EntityContentDiffView.php
b/repo/includes/Diff/EntityContentDiffView.php
index d7852ac..bdf07fe 100644
--- a/repo/includes/Diff/EntityContentDiffView.php
+++ b/repo/includes/Diff/EntityContentDiffView.php
@@ -153,6 +153,11 @@
$parserOptions->addExtraKey( 'diff=1' );
$parserOutput = $page->getParserOutput( $parserOptions,
$rev->getId() );
+ $parserOutput->setText( preg_replace(
+ '#<wb:sectionedit>.*?</wb:sectionedit>#s',
+ '',
+ $parserOutput->getRawText()
+ ) );
return $parserOutput;
}
--
To view, visit https://gerrit.wikimedia.org/r/394973
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iad4f8f8458a4d4d38b4874df86191c30f2ac5229
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits