Matthias Mullie has uploaded a new change for review. https://gerrit.wikimedia.org/r/123217
Change subject: Make timestamps link to the revision at that particular point in time ...................................................................... Make timestamps link to the revision at that particular point in time Similar to how it's done for regular articles Change-Id: I42a860e1932ab0dd2a701256c9c6203030cf28c3 --- M FlowActions.php M i18n/en.json M i18n/qqq.json M includes/Formatter/AbstractFormatter.php M includes/Formatter/RevisionFormatter.php 5 files changed, 80 insertions(+), 15 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/17/123217/1 diff --git a/FlowActions.php b/FlowActions.php index 8e8b8e7..15b7c2e 100644 --- a/FlowActions.php +++ b/FlowActions.php @@ -37,7 +37,7 @@ Header::MODERATED_NONE => '', ), 'button-method' => 'POST', - 'links' => array( 'board-history', 'board' ), + 'links' => array( 'board-history', 'board', 'header-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-create-header', 'i18n-params' => array( @@ -56,7 +56,7 @@ Header::MODERATED_NONE => '', ), 'button-method' => 'POST', - 'links' => array( 'board-history', 'diff-header', 'board' ), + 'links' => array( 'board-history', 'diff-header', 'board', 'header-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-edit-header', 'i18n-params' => array( @@ -75,7 +75,7 @@ PostRevision::MODERATED_NONE => '', ), 'button-method' => 'GET', - 'links' => array( 'topic', 'topic-history', 'diff-post' ), + 'links' => array( 'topic', 'topic-history', 'diff-post', 'topic-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-edit-title', 'i18n-params' => array( @@ -99,7 +99,7 @@ PostRevision::MODERATED_NONE => '', ), 'button-method' => 'POST', - 'links' => array( 'topic-history', 'topic', 'post' ), + 'links' => array( 'topic-history', 'topic', 'post', 'topic-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-new-post', 'i18n-params' => array( @@ -123,7 +123,7 @@ } ), 'button-method' => 'GET', - 'links' => array( 'post-history', 'topic', 'post', 'diff-post' ), + 'links' => array( 'post-history', 'topic', 'post', 'diff-post', 'post-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-edit-post', 'i18n-params' => array( @@ -147,7 +147,7 @@ PostRevision::MODERATED_NONE => array( 'flow-hide', 'flow-delete', 'flow-suppress' ), ), 'button-method' => 'POST', - 'links' => array( 'topic', 'post-history' ), + 'links' => array( 'topic', 'post-history', 'post-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-hid-post', 'i18n-params' => array( @@ -170,7 +170,7 @@ PostRevision::MODERATED_NONE => array( 'flow-hide', 'flow-delete', 'flow-suppress' ), ), 'button-method' => 'POST', - 'links' => array( 'topic', 'post', 'post-history' ), + 'links' => array( 'topic', 'post', 'post-history', 'topic-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-hid-topic', 'i18n-params' => array( @@ -194,7 +194,7 @@ PostRevision::MODERATED_HIDDEN => array( 'flow-delete', 'flow-suppress' ), ), 'button-method' => 'POST', - 'links' => array( 'topic', 'post-history' ), + 'links' => array( 'topic', 'post-history', 'post-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-deleted-post', 'i18n-params' => array( @@ -218,7 +218,7 @@ PostRevision::MODERATED_HIDDEN => array( 'flow-delete', 'flow-suppress' ), ), 'button-method' => 'POST', - 'links' => array( 'topic', 'topic-history' ), + 'links' => array( 'topic', 'topic-history', 'topic-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-deleted-topic', 'i18n-params' => array( @@ -243,7 +243,7 @@ PostRevision::MODERATED_DELETED => 'flow-suppress', ), 'button-method' => 'POST', - 'links' => array( 'topic', 'topic-history' ), + 'links' => array( 'topic', 'topic-history', 'post-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-suppressed-post', 'i18n-params' => array( @@ -268,7 +268,7 @@ PostRevision::MODERATED_DELETED => 'flow-suppress', ), 'button-method' => 'POST', - 'links' => array( 'topic', 'topic-history' ), + 'links' => array( 'topic', 'topic-history', 'topic-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-suppressed-topic', 'i18n-params' => array( @@ -316,7 +316,7 @@ PostRevision::MODERATED_SUPPRESSED => 'flow-suppress', ), 'button-method' => 'POST', - 'links' => array( 'topic', 'post-history' ), + 'links' => array( 'topic', 'post-history', 'post-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-restored-post', 'i18n-params' => array( @@ -368,7 +368,7 @@ PostRevision::MODERATED_SUPPRESSED => 'flow-suppress', ), 'button-method' => 'POST', - 'links' => array( 'topic', 'topic-history' ), + 'links' => array( 'topic', 'topic-history', 'topic-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-restored-topic', 'i18n-params' => array( @@ -413,7 +413,7 @@ PostRevision::MODERATED_NONE => '', ), 'button-method' => 'GET', - 'links' => array( 'topic-history', 'topic', 'post' ), + 'links' => array( 'topic-history', 'topic', 'post', 'post-revision' ), 'history' => array( 'i18n-message' => 'flow-rev-message-reply', 'i18n-params' => array( diff --git a/i18n/en.json b/i18n/en.json index 8b69cb1..386a3a0 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -186,6 +186,9 @@ "flow-link-topic": "topic", "flow-link-board": "board", "flow-link-history": "history", + "flow-link-post-revision": "post revision", + "flow-link-topic-revision": "topic revision", + "flow-link-header-revision": "header revision", "flow-moderation-reason-placeholder": "Enter your reason here", "flow-moderation-title-suppress-post": "Suppress post?", "flow-moderation-title-delete-post": "Delete post?", diff --git a/i18n/qqq.json b/i18n/qqq.json index f95cccd..5d5f602 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -188,6 +188,9 @@ "flow-link-topic": "Text used when linking to a topic from recentchanges.\n{{Identical|Topic}}", "flow-link-board": "Text used when linking to a board from recentchanges.", "flow-link-history": "Text used when linking to history of a post/topic from recentchanges.\n{{Identical|History}}", + "flow-link-post-revision": "Text used when linking to a specific revision of a post", + "flow-link-topic-revision": "Text used when linking to a specific revision of a topic", + "flow-link-header-revision": "Text used when linking to a specific revision of a header.", "flow-moderation-reason-placeholder": "Placeholder text for the textbox that holds the reason field on moderation confirmation dialogs.", "flow-moderation-title-suppress-post": "Title for the moderation confirmation dialog when a post is being suppressed.\n{{Related|Flow-moderation-title}}", "flow-moderation-title-delete-post": "Title for the moderation confirmation dialog when a post is being deleted.\n{{Related|Flow-moderation-title}}\n{{Identical|Delete post}}", diff --git a/includes/Formatter/AbstractFormatter.php b/includes/Formatter/AbstractFormatter.php index 5c5b8a4..e812e26 100644 --- a/includes/Formatter/AbstractFormatter.php +++ b/includes/Formatter/AbstractFormatter.php @@ -58,7 +58,7 @@ * have the same kind of links available) * @return string HTML */ - protected function formatTimestamp( array $data, $key = 'timeAndDate', $linkKeys = array( 'topic', 'board' ) ) { + protected function formatTimestamp( array $data, $key = 'timeAndDate', $linkKeys = array( 'header-revision', 'topic-revision', 'post-revision' ) ) { // Format timestamp: add link $formattedTime = $data['dateFormats'][$key]; diff --git a/includes/Formatter/RevisionFormatter.php b/includes/Formatter/RevisionFormatter.php index a75483a..840e60c 100644 --- a/includes/Formatter/RevisionFormatter.php +++ b/includes/Formatter/RevisionFormatter.php @@ -173,6 +173,65 @@ ); break; + case 'header-revision': + if ( !$revId ) { + wfDebugLog( 'Flow', __METHOD__ . ': No revId available to render revision link' ); + break; + } + + $links['header-revision'] = array( + $this->urlGenerator->buildUrl( + $title, + 'view', + array( + 'workflow' => $workflowId->getAlphadecimal(), + 'header_revId' => $revId->getAlphadecimal(), + ) + ), + wfMessage( 'flow-link-header-revision' ) + ); + break; + + case 'topic-revision': + if ( !$revId ) { + wfDebugLog( 'Flow', __METHOD__ . ': No revId available to render revision link' ); + break; + } + + $links['topic-revision'] = array( + $this->urlGenerator->buildUrl( + $title, + 'view', + array( + 'workflow' => $workflowId->getAlphadecimal(), + 'topic_postId' => $postId->getAlphadecimal(), + 'topic_revId' => $revId->getAlphadecimal(), + ) + ), + wfMessage( 'flow-link-topic-revision' ) + ); + break; + + case 'post-revision': + if ( !$revId ) { + wfDebugLog( 'Flow', __METHOD__ . ': No revId available to render revision link' ); + break; + } + + $links['post-revision'] = array( + $this->urlGenerator->buildUrl( + $title, + 'view', + array( + 'workflow' => $workflowId->getAlphadecimal(), + 'topic_postId' => $postId->getAlphadecimal(), + 'topic_revId' => $revId->getAlphadecimal(), + ) + ), + wfMessage( 'flow-link-post-revision' ) + ); + break; + case 'post-history': $links['post-history'] = array( $this->urlGenerator->buildUrl( -- To view, visit https://gerrit.wikimedia.org/r/123217 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I42a860e1932ab0dd2a701256c9c6203030cf28c3 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