Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/93487
Change subject: Only link to history if there are changes
......................................................................
Only link to history if there are changes
Change-Id: I8685ad72560add0d3c49cacbc45f91160a25085e
---
M includes/View/Post.php
M templates/topic.html.php
2 files changed, 26 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/87/93487/1
diff --git a/includes/View/Post.php b/includes/View/Post.php
index 0546624..25cb74a 100644
--- a/includes/View/Post.php
+++ b/includes/View/Post.php
@@ -88,7 +88,7 @@
}
public function postHistoryButton( PostRevision $post, $content ) {
- if ( $this->actions->isAllowed( 'post-history' ) ) {
+ if ( !$post->isFirstRevision() && $this->actions->isAllowed(
'post-history' ) ) {
return $this->actions->getButton(
'post-history',
$content,
diff --git a/templates/topic.html.php b/templates/topic.html.php
index a0212d7..f940a24 100644
--- a/templates/topic.html.php
+++ b/templates/topic.html.php
@@ -54,14 +54,31 @@
<span class="flow-agotime"
style="display: inline">' . htmlspecialchars(
$topic->getLastModifiedObj()->getHumanTimestamp() ) . '</span>
<span class="flow-utctime"
style="display: none">' . htmlspecialchars(
$topic->getLastModifiedObj()->getTimestamp( TS_RFC2822 ) ) . '</span>';
- // build history button with timestamp html as
content
- echo Html::rawElement( 'a',
- array(
- 'class' =>
'flow-action-history-link',
- 'href' => $this->generateUrl(
$root->getPostId(), 'topic-history' ),
- ),
- $content
- );
+ $children = $root->getChildren();
+
+ // Timestamp should be turned into a link to
history if:
+ $history = false;
+ // topic title has changed
+ $history |= !$root->isFirstRevision();
+ // topic has more than 1 comment
+ $history |= count( $children ) > 1;
+ // first comment was submitted separately from
topic title
+ $history |= isset( $children[0] ) &&
$children[0]->getRevisionId()->getTimestamp() !==
$root->getRevisionId()->getTimestamp();
+ // original topic comment has replies
+ $history |= isset( $children[0] ) && count(
$children[0]->getChildren() ) > 0;
+
+ if ( $history ) {
+ // build history button with timestamp
html as content
+ echo Html::rawElement( 'a',
+ array(
+ 'class' =>
'flow-action-history-link',
+ 'href' =>
$this->generateUrl( $root->getPostId(), 'topic-history' ),
+ ),
+ $content
+ );
+ } else {
+ echo $content;
+ }
?>
</p>
--
To view, visit https://gerrit.wikimedia.org/r/93487
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8685ad72560add0d3c49cacbc45f91160a25085e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits