Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/168825
Change subject: Remove code in ViewEntityAction, duplicating
Article::isCurrent()
......................................................................
Remove code in ViewEntityAction, duplicating Article::isCurrent()
also improved code that checks if viewing a diff
Change-Id: If2e6758f113dd0897d5aab67b84a4377cce6ac65
---
M repo/includes/actions/ViewEntityAction.php
1 file changed, 9 insertions(+), 17 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/25/168825/1
diff --git a/repo/includes/actions/ViewEntityAction.php
b/repo/includes/actions/ViewEntityAction.php
index 96a47f9..f5f304b 100644
--- a/repo/includes/actions/ViewEntityAction.php
+++ b/repo/includes/actions/ViewEntityAction.php
@@ -132,25 +132,18 @@
* of the page's current revision.
*/
private function isEditable() {
- $article = $this->getArticle();
-
- if ( !$article->getPage()->exists() ) {
- // showing non-existing entity
- return false;
- }
-
- if ( $article->getOldID() > 0
- && ( $article->getOldID() !==
$article->getPage()->getLatest() ) ) {
- // showing old content
- return false;
- }
-
- if ( $this->getRequest()->getCheck( 'diff' ) ) {
- // showing a diff
+ if ( !$this->getArticle()->isCurrent() || $this->isDiff() ) {
return false;
}
return true;
+ }
+
+ /**
+ * @return boolean
+ */
+ private function isDiff() {
+ return $this->getRequest()->getCheck( 'diff' );
}
/**
@@ -178,7 +171,6 @@
$editable = $permissionStatus->isOK();
}
- // View it!
$parserOptions =
$this->getArticle()->getPage()->makeParserOptions(
$this->getContext()->getUser() );
if ( !$editable ) {
@@ -204,7 +196,7 @@
}
// Create and set the title.
- if ( $this->getRequest()->getCheck( 'diff' ) ) {
+ if ( $this->isDiff() ) {
// Escaping HTML characters in order to retain original
label that may contain HTML
// characters. This prevents having characters
evaluated or stripped via
// OutputPage::setPageTitle:
--
To view, visit https://gerrit.wikimedia.org/r/168825
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If2e6758f113dd0897d5aab67b84a4377cce6ac65
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits