Matthias Mullie has uploaded a new change for review.

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

Change subject: (Bug 61715) Make history entries look at most recent revision
......................................................................

(Bug 61715) Make history entries look at most recent revision

@todo: this is WIP
The problem with history thingies is that "restore" should not show up for users
that can not view the permissions for what is restored.
isAllowed will check the most recent revision to get some sort of "global
allowed state" for a revision. Combined with the above, this would make any
revision of a just-restored post be invisible.
For that reason, I made history (and RC) permission checks only do
isRevisionAllowed. That's incorrect; they should also check last revision (but
in a way that is actually correct)
Still working on that, but wanted to get a (currently failing) test in already

Bug: 61715
Change-Id: Ia27c94176bb8f40f2fe683a54ab9ddafb4f98fc0
---
M includes/Block/Topic.php
M includes/RevisionActionPermissions.php
M tests/RevisionCollectionPermissionsTest.php
3 files changed, 14 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/79/114679/1

diff --git a/includes/Block/Topic.php b/includes/Block/Topic.php
index 40534ab..0fcaddb 100644
--- a/includes/Block/Topic.php
+++ b/includes/Block/Topic.php
@@ -869,6 +869,8 @@
                if ( $history ) {
                        // get rid of history entries user doesn't have 
sufficient permissions for
                        foreach ( $history as $i => $revision ) {
+                               /** @var PostRevision $revision */
+
                                // only check against the specific revision, 
ignoring the most recent
                                if ( !$this->permissions->isRevisionAllowed( 
$revision, 'topic-history' ) ) {
                                        unset( $history[$i] );
diff --git a/includes/RevisionActionPermissions.php 
b/includes/RevisionActionPermissions.php
index 2d59074..279285d 100644
--- a/includes/RevisionActionPermissions.php
+++ b/includes/RevisionActionPermissions.php
@@ -73,7 +73,7 @@
                        $isLastRevision = $last->getRevisionId()->equals( 
$revision->getRevisionId() );
                        return $allowed && ( $isLastRevision || 
$this->isAllowed( $last, $action ) );
 
-                       // If data is not in storage, just return that 
revision's status
+               // If data is not in storage, just return that revision's status
                } catch ( InvalidDataException $e ) {
                        return $allowed;
                }
diff --git a/tests/RevisionCollectionPermissionsTest.php 
b/tests/RevisionCollectionPermissionsTest.php
index 62637af..6526f5e 100644
--- a/tests/RevisionCollectionPermissionsTest.php
+++ b/tests/RevisionCollectionPermissionsTest.php
@@ -147,6 +147,17 @@
                                array( 'restore-post' => true ),
                                array( 'suppress-post' => true ),
                        ) ),
+
+                       // bug 61715
+                       array( $this->confirmedUser(), 'topic-history', array(
+                               array( 'new-post' => false ),
+                               array( 'suppress-post' => false ),
+                       ) ),
+                       array( $this->confirmedUser(), 'topic-history', array(
+                               array( 'new-post' => true ),
+                               array( 'suppress-post' => false ),
+                               array( 'restore-post' => false ),
+                       ) ),
                );
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia27c94176bb8f40f2fe683a54ab9ddafb4f98fc0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>

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

Reply via email to