Sbisson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/240366
Change subject: Fix 'cur' and 'prev' links for topic summary
......................................................................
Fix 'cur' and 'prev' links for topic summary
* Fix caching of topic summary current revision.
* Fix extraction of oldRevision parameter.
* Make 'create-topic-summary' generate a 'diff-post-summary' link.
Bug: T113261
Change-Id: Ie7c179e73cc405e75d0011be2cc9300cc0c27c8b
---
M FlowActions.php
M includes/Block/TopicSummary.php
M includes/Formatter/AbstractQuery.php
3 files changed, 16 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/66/240366/1
diff --git a/FlowActions.php b/FlowActions.php
index 3e696b9..472037f 100644
--- a/FlowActions.php
+++ b/FlowActions.php
@@ -133,7 +133,7 @@
PostRevision::MODERATED_NONE => '',
PostRevision::MODERATED_LOCKED => '',
),
- 'links' => array( 'topic', 'topic-history', 'watch-topic',
'unwatch-topic', 'summary-revision' ),
+ 'links' => array( 'topic', 'topic-history',
'diff-post-summary', 'watch-topic', 'unwatch-topic', 'summary-revision' ),
'actions' => array( 'edit-topic-summary', 'lock-topic',
'restore-topic' ),
'history' => array(
'i18n-message' =>
'flow-rev-message-create-topic-summary',
diff --git a/includes/Block/TopicSummary.php b/includes/Block/TopicSummary.php
index 476b6c0..3080606 100644
--- a/includes/Block/TopicSummary.php
+++ b/includes/Block/TopicSummary.php
@@ -278,7 +278,7 @@
}
$oldRevision = null;
if ( isset( $options['oldRevision'] ) ) {
- $oldRevision = $options['newRevision'];
+ $oldRevision = $options['oldRevision'];
}
list( $new, $old ) = Container::get(
'query.postsummary.view' )->getDiffViewResult( UUID::create(
$options['newRevision'] ), UUID::create( $oldRevision ) );
if (
diff --git a/includes/Formatter/AbstractQuery.php
b/includes/Formatter/AbstractQuery.php
index 5c0cd36..0bbd072 100644
--- a/includes/Formatter/AbstractQuery.php
+++ b/includes/Formatter/AbstractQuery.php
@@ -177,7 +177,8 @@
/** @var AbstractRevision[] $result */
foreach ( $found as $result ) {
$rev = reset( $result );
-
$this->currentRevisionsCache[$rev->getCollectionId()->getAlphadecimal()] =
$rev->getRevisionId();
+ $cacheKey = $this->getCurrentRevisionCacheKey(
$rev );
+ $this->currentRevisionsCache[$cacheKey] =
$rev->getRevisionId();
$revisions[$rev->getRevisionId()->getAlphadecimal()] = $rev;
}
}
@@ -328,15 +329,15 @@
* @return AbstractRevision|null AbstractRevision of the current
revision.
*/
protected function getCurrentRevision( AbstractRevision $revision ) {
- $collectionId = $revision->getCollectionId();
- if ( !isset(
$this->currentRevisionsCache[$collectionId->getAlphadecimal()] ) ) {
+ $cacheKey = $this->getCurrentRevisionCacheKey( $revision );
+ if ( !isset( $this->currentRevisionsCache[$cacheKey] ) ) {
$currentRevision =
$revision->getCollection()->getLastRevision();
-
$this->currentRevisionsCache[$collectionId->getAlphadecimal()] =
$currentRevision->getRevisionId();
+ $this->currentRevisionsCache[$cacheKey] =
$currentRevision->getRevisionId();
$this->revisionCache[$currentRevision->getRevisionId()->getAlphadecimal()] =
$currentRevision;
}
- $currentRevisionId =
$this->currentRevisionsCache[$collectionId->getAlphadecimal()];
+ $currentRevisionId = $this->currentRevisionsCache[$cacheKey];
return
$this->revisionCache[$currentRevisionId->getAlphaDecimal()];
}
@@ -397,6 +398,14 @@
return $this->workflowCache[$alpha] =
$this->storage->get( 'Workflow', $workflowId );
}
}
+
+ /**
+ * @param AbstractRevision $revision
+ * @return string
+ */
+ protected function getCurrentRevisionCacheKey( AbstractRevision
$revision ) {
+ return $revision->getRevisionType() . '-' .
$revision->getCollectionId()->getAlphadecimal();
+ }
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/240366
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7c179e73cc405e75d0011be2cc9300cc0c27c8b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Sbisson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits