Merge "Link to the section (if known) from the orange banner"

This commit is contained in:
jenkins-bot 2021-08-06 09:27:41 +00:00 committed by Gerrit Code Review
commit afe6a50d3a

View file

@ -1097,6 +1097,18 @@ class EchoHooks implements RecentChange_saveHook {
'class' => [ 'mw-echo-alert' ],
]
);
// If there's exactly one new user talk message, then link directly to it from the alert.
$notificationMapper = new EchoNotificationMapper();
$notifications = $notificationMapper->fetchUnreadByUser( $user, 2, null, [ 'edit-user-talk' ] );
if ( count( $notifications ) === 1 ) {
$presModel = EchoEventPresentationModel::factory(
current( $notifications )->getEvent(),
$out->getLanguage(),
$user
);
$links['notifications']['talk-alert']['href'] = $presModel->getPrimaryLink()['url'];
}
}
$links['notifications']['notifications-alert'] = [