jenkins-bot has submitted this change and it was merged.
Change subject: Refactor another big method in ViewEntityAction
......................................................................
Refactor another big method in ViewEntityAction
Change-Id: I6a707f14aaff690cdd344dce3a0117e2404ee041
---
M repo/includes/actions/ViewEntityAction.php
1 file changed, 16 insertions(+), 13 deletions(-)
Approvals:
Daniel Kinzler: Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/includes/actions/ViewEntityAction.php
b/repo/includes/actions/ViewEntityAction.php
index 7160d7c..a83ded6 100644
--- a/repo/includes/actions/ViewEntityAction.php
+++ b/repo/includes/actions/ViewEntityAction.php
@@ -131,17 +131,15 @@
/**
* Returns true if this view action is performing a plain view (not a
diff, etc)
* of the page's current revision.
+ *
+ * @return bool
*/
private function isEditable() {
- if ( !$this->getArticle()->isCurrent() || $this->isDiff() ) {
- return false;
- }
-
- return true;
+ return !$this->isDiff() && $this->getArticle()->isCurrent();
}
/**
- * @return boolean
+ * @return bool
*/
private function isDiff() {
return $this->getRequest()->getCheck( 'diff' );
@@ -187,6 +185,7 @@
/**
* @param OutputPage $outputPage
+ * @param EntityContent $content
*/
private function applyLabelToTitleText( OutputPage $outputPage,
EntityContent $content ) {
// Figure out which label to use for title.
@@ -256,8 +255,6 @@
* @since 0.1
*/
protected function displayMissingEntity() {
- global $wgSend404Code;
-
$title = $this->getArticle()->getTitle();
$oldid = $this->getArticle()->getOldID();
@@ -278,11 +275,7 @@
'msgKey' => array( 'moveddeleted-notice' ) )
);
- if ( $wgSend404Code ) {
- // If there's no backing content, send a 404 Not Found
- // for better machine handling of broken links.
- $this->getRequest()->response()->header( "HTTP/1.1 404
Not Found" );
- }
+ $this->send404Code();
$hookResult = wfRunHooks( 'BeforeDisplayNoArticleText', array(
$this ) );
@@ -323,6 +316,16 @@
}
}
+ private function send404Code() {
+ global $wgSend404Code;
+
+ if ( $wgSend404Code ) {
+ // If there's no backing content, send a 404 Not Found
+ // for better machine handling of broken links.
+ $this->getRequest()->response()->header( 'HTTP/1.1 404
Not Found' );
+ }
+ }
+
/**
* @see Action::getDescription()
*/
--
To view, visit https://gerrit.wikimedia.org/r/169352
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6a707f14aaff690cdd344dce3a0117e2404ee041
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits