mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-12 09:26:05 +00:00
Merge "Link to the section (if known) from the orange banner"
This commit is contained in:
commit
afe6a50d3a
|
@ -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'] = [
|
||||
|
|
Loading…
Reference in a new issue