Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/169352

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/52/169352/1

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: newchange
Gerrit-Change-Id: I6a707f14aaff690cdd344dce3a0117e2404ee041
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to