EBernhardson has uploaded a new change for review.

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

Change subject: Ensure posts created by TopicListQuery::createFakePosts render
......................................................................

Ensure posts created by TopicListQuery::createFakePosts render

These fake posts are created when a UUID is identified as part
of the topic tree, but for one reason or another could not
be loaded from the database.

Unfortunatly the call to AbstractQuery::getCurrentRevision was
causing these fake posts to not render, we were not able to
locate the current revision (because thats the fake post).

Based on the queries in TopicListQuery we know that the only
revisions loaded are the most recent versions, so override
AbstractQuery::getCurrentRevision and return them directly.

The easiest way to see the patch work is to add

  unset( $posts[array_rand($posts)] );

to TopicListQuery::getResults immediatly after

  $posts = $this->collectRevisions( $allPostIds );

Change-Id: Idc183dbb5e51c4aeb7025d4a68ae9e429f08d45f
---
M includes/Formatter/RevisionFormatter.php
M includes/Formatter/TopicListQuery.php
2 files changed, 14 insertions(+), 4 deletions(-)


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

diff --git a/includes/Formatter/RevisionFormatter.php 
b/includes/Formatter/RevisionFormatter.php
index 55ab02b..8bfdcdb 100644
--- a/includes/Formatter/RevisionFormatter.php
+++ b/includes/Formatter/RevisionFormatter.php
@@ -340,7 +340,8 @@
                $postId = method_exists( $revision, 'getPostId' ) ? 
$revision->getPostId() : null;
                $actionTypes = $this->permissions->getActions()->getValue( 
$action, 'actions' );
                if ( $actionTypes === null ) {
-                       throw new FlowException( "No actions defined for 
action: $action" );
+                       wfDebugLog( 'Flow', __METHOD__ . ": No actions defined 
for action: $action" );
+                       return array();
                }
 
                // actions primarily vary by revision type...
diff --git a/includes/Formatter/TopicListQuery.php 
b/includes/Formatter/TopicListQuery.php
index 3f0de94..80677ce 100644
--- a/includes/Formatter/TopicListQuery.php
+++ b/includes/Formatter/TopicListQuery.php
@@ -4,6 +4,7 @@
 
 use Flow\Data\ManagerGroup;
 use Flow\Exception\FlowException;
+use Flow\Model\AbstractRevision;
 use Flow\Model\PostRevision;
 use Flow\Model\PostSummary;
 use Flow\Model\TopicListEntry;
@@ -27,12 +28,12 @@
        }
 
        /**
-        * @param TopicListEntry[] $topicRevisions
+        * @param UUID[]|TopicListEntry[] $topicRevisionIds
         * @return FormatterRow[]
         */
-       public function getResults( array $topicRevisions ) {
+       public function getResults( array $topicRevisionIds ) {
                $section = new \ProfileSection( __METHOD__ );
-               $topicIds = $this->getTopicIds( $topicRevisions );
+               $topicIds = $this->getTopicIds( $topicRevisionIds );
                $allPostIds = $this->collectPostIds( $topicIds );
                $topicSummary = $this->collectSummary( $topicIds );
                $posts = $this->collectRevisions( $allPostIds );
@@ -177,6 +178,14 @@
        }
 
        /**
+        * Override parent, we only load the most recent version, so just
+        * return self.
+        */
+       protected function getCurrentRevision( AbstractRevision $revision ) {
+               return $revision;
+       }
+
+       /**
         * @param UUID[] $missing
         * @return PostRevision
         */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc183dbb5e51c4aeb7025d4a68ae9e429f08d45f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to