From 4c58a85bb1c06e97ebe84557b85ca3504894ab2d Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Tue, 1 Jun 2021 14:14:41 -0700 Subject: [PATCH] Echo hook needs to consider other hook modifications Follow up to 7880cc1 Bug: T274428 Change-Id: Ia4520a3df28027d43ecdeb217b108669e7cb6795 --- includes/EchoHooks.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/EchoHooks.php b/includes/EchoHooks.php index bc717ccbf..6dc905809 100644 --- a/includes/EchoHooks.php +++ b/includes/EchoHooks.php @@ -1125,18 +1125,20 @@ class EchoHooks implements RecentChange_saveHook { $alertLinkClasses[] = 'mw-echo-notifications-badge-long-label'; } + $mytalk = $links['user-menu']['mytalk'] ?? false; if ( + $mytalk && self::shouldDisplayTalkAlert( $user, $title ) && MediaWikiServices::getInstance() ->getHookContainer()->run( 'BeforeDisplayOrangeAlert', [ $user, $title ] ) ) { // Move `mytalk` from `user-menu` to `notifications`. $links['notifications']['mytalk'] = [ - 'href' => $links['user-menu']['mytalk']['href'], - 'text' => $skinTemplate->msg( 'echo-new-messages' ), + 'href' => $mytalk['href'], + 'text' => $skinTemplate->msg( 'echo-new-messages' )->text(), - 'active' => $links['user-menu']['mytalk']['active'], - 'exists' => $links['user-menu']['mytalk']['exists'], + 'active' => $mytalk['active'], + 'exists' => $mytalk['exists'], 'link-class' => [ 'mw-echo-alert' ], // Id of `pt-mytalk` is important for Linker to set the `title` and // `accesskey` attributes.