Jeroen De Dauw has submitted this change and it was merged.

Change subject: Adjust getPermissionForTitle method to getEditPermissionForTitle
......................................................................


Adjust getPermissionForTitle method to getEditPermissionForTitle

Change-Id: I4a376dcc14f195c86cae20ebdd00719c437c7002
---
M repo/includes/actions/ViewEntityAction.php
M repo/includes/content/EntityContentFactory.php
M repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
3 files changed, 6 insertions(+), 8 deletions(-)

Approvals:
  Jeroen De Dauw: Looks good to me, approved



diff --git a/repo/includes/actions/ViewEntityAction.php 
b/repo/includes/actions/ViewEntityAction.php
index e814904..d65e40c 100644
--- a/repo/includes/actions/ViewEntityAction.php
+++ b/repo/includes/actions/ViewEntityAction.php
@@ -163,11 +163,10 @@
 
                if ( $editable && !$content->isRedirect() ) {
                        $permissionChecker = $this->getPermissionChecker();
-                       $editable = $permissionChecker->getPermissionForTitle(
+                       $editable = 
$permissionChecker->getEditPermissionForTitle(
                                $this->getArticle()->getTitle(),
                                $content,
-                               $this->getUser(),
-                               'edit'
+                               $this->getUser()
                        );
                }
 
diff --git a/repo/includes/content/EntityContentFactory.php 
b/repo/includes/content/EntityContentFactory.php
index b130d67..aefe580 100644
--- a/repo/includes/content/EntityContentFactory.php
+++ b/repo/includes/content/EntityContentFactory.php
@@ -315,18 +315,17 @@
         * @param Title $title
         * @param EntityContent $content
         * @param User $user
-        * @param string $permission
         *
         * @return boolean
         */
-       public function getPermissionForTitle( Title $title, EntityContent 
$content, User $user, $permission ) {
+       public function getEditPermissionForTitle( Title $title, EntityContent 
$content, User $user ) {
                $entityContentTitle = $this->getTitleForId( 
$content->getEntity()->getId() );
 
                if ( $entityContentTitle->getFullText() !== 
$title->getFullText() ) {
                        throw new MWException( '$title does not match content' 
);
                }
 
-               $errors = $title->getUserPermissionsErrors( $permission, $user, 
'quick' );
+               $errors = $title->getUserPermissionsErrors( 'edit', $user, 
'quick' );
                $permissionStatus = $this->getStatusForPermissionErrors( 
$errors );
 
                return $permissionStatus->isOK();
diff --git a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php 
b/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
index e18755a..40f4c2b 100644
--- a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
+++ b/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
@@ -151,7 +151,7 @@
                                        'getPermissionStatusForEntity' => true,
                                        'getPermissionStatusForEntityType' => 
true,
                                        'getPermissionStatusForEntityId' => 
true,
-                                       'getPermissionForTitle' => true,
+                                       'getEditPermissionForTitle' => true,
                                ),
                        ),
                        'edit not allowed' => array(
@@ -162,7 +162,7 @@
                                        'getPermissionStatusForEntity' => false,
                                        'getPermissionStatusForEntityType' => 
false,
                                        'getPermissionStatusForEntityId' => 
false,
-                                       'getPermissionForTitle' => false,
+                                       'getEditPermissionForTitle' => false,
                                ),
                        ),
                        'delete not allowed' => array(

-- 
To view, visit https://gerrit.wikimedia.org/r/170693
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4a376dcc14f195c86cae20ebdd00719c437c7002
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to