jenkins-bot has submitted this change and it was merged.

Change subject: Mention notif has wrong anchor for header with link
......................................................................


Mention notif has wrong anchor for header with link

Bug: 47999
Change-Id: Id295c1b4129b68e7a16db94bc32d0d1b65177012
---
M Echo.php
M formatters/CommentFormatter.php
2 files changed, 9 insertions(+), 5 deletions(-)

Approvals:
  Kaldari: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Echo.php b/Echo.php
index d2c0578..ba52f19 100644
--- a/Echo.php
+++ b/Echo.php
@@ -420,10 +420,10 @@
                'group' => 'interactive',
                'formatter-class' => 'EchoCommentFormatter',
                'title-message' => 'notification-mention',
-               'title-params' => array( 'agent', 'subject', 'title' ),
+               'title-params' => array( 'agent', 'subject-anchor', 'title' ),
                'payload' => array( 'summary' ),
                'flyout-message' => 'notification-mention-flyout',
-               'flyout-params' => array( 'agent', 'subject',  'title' ),
+               'flyout-params' => array( 'agent', 'subject-anchor',  'title' ),
                'email-subject-message' => 'notification-mention-email-subject',
                'email-subject-params' => array( 'agent' ),
                'email-body-message' => 'notification-mention-email-body',
diff --git a/formatters/CommentFormatter.php b/formatters/CommentFormatter.php
index a7e60ee..9dbddd0 100644
--- a/formatters/CommentFormatter.php
+++ b/formatters/CommentFormatter.php
@@ -48,9 +48,13 @@
         */
        protected function processParam( $event, $param, $message, $user ) {
                $extra = $event->getExtra();
-               if ( $param === 'subject' ) {
-                       if ( isset( $extra['section-title'] ) && 
$extra['section-title'] ) {
-                               $message->params( $extra['section-title'] );
+               if ( $param === 'subject-anchor' ) {
+                       global $wgParser;
+                       if ( !empty( $extra['section-title'] ) ) {
+                               $message->params(
+                                       // Strip out #, keeping # in the i18n 
message makes it look more clear
+                                       substr( 
$wgParser->guessLegacySectionNameFromWikiText( $extra['section-title'] ), 1 )
+                               );
                        } else {
                                $message->params( '' );
                        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id295c1b4129b68e7a16db94bc32d0d1b65177012
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: EBernhardson (WMF) <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Lwelling <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to