Bsitu has uploaded a new change for review.
https://gerrit.wikimedia.org/r/93583
Change subject: Post link in notification should take users to specific post
......................................................................
Post link in notification should take users to specific post
bug: 56271
Change-Id: Ie2d9249939c39d71edebdcf8edc0360f0b258243
---
M includes/Notifications/Formatter.php
1 file changed, 12 insertions(+), 14 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/83/93583/1
diff --git a/includes/Notifications/Formatter.php
b/includes/Notifications/Formatter.php
index 907a96c..9cde445 100644
--- a/includes/Notifications/Formatter.php
+++ b/includes/Notifications/Formatter.php
@@ -35,19 +35,16 @@
}
} elseif ( $param === 'post-permalink' ) {
$postId = $extra['post-id'];
- $urlParams = array( );
-
- if ( $this->bundleData['raw-data-count'] <= 1 ) {
- $urlParams['topic[postId]'] = $postId->getHex();
- }
-
- $url = $this->getUrlGenerator()->generateUrl(
+ list( $title, $query ) =
$this->getUrlGenerator()->generateUrlData(
$extra['topic-workflow'],
- 'view',
- $urlParams
+ 'view'
);
-
- $message->params( $url );
+ // Take user to the post if there is only one target
post,
+ // otherwise, take user to the topic view
+ if ( $this->bundleData['raw-data-count'] <= 1 ) {
+ $title->setFragment( '#flow-post-' .
$postId->getHex() );
+ }
+ $message->params( $title->getFullUrl( $query ) );
} elseif ( $param === 'topic-permalink' ) {
$url = $this->getUrlGenerator()->generateUrl(
$extra['topic-workflow'] );
@@ -89,11 +86,12 @@
$post = $event->getExtraParam( 'post-id' );
$flow = $event->getExtraParam(
'topic-workflow' );
if ( $post && $flow && $title ) {
- $urlParams = array( 'workflow' =>
$flow->getHex() );
+ list( $target, $query ) =
$urlGenerator->generateUrlData( $flow );
+ // Take user to the post if there is
only one target post,
+ // otherwise, take user to the topic
view
if (
$this->bundleData['raw-data-count'] <= 1 ) {
- $urlParams['topic[postId]'] =
$post->getHex();
+ $target->setFragment(
'#flow-post-' . $post->getHex() );
}
- list( $target, $query ) =
$urlGenerator->generateUrlData( $flow, $urlParams );
}
break;
case 'flow-board':
--
To view, visit https://gerrit.wikimedia.org/r/93583
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie2d9249939c39d71edebdcf8edc0360f0b258243
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits