Add diff link to page-linked notification

Will only show for new instances, because the information
will be unavailable for old ones.

Bug: T135959
Depends-On: I3d894acaf3d85b790e5034c7d9f76bf94672f445
Change-Id: I04620678dd0ebffb3b1a92a9a0587cb7557d77f4
This commit is contained in:
Roan Kattouw 2016-05-23 12:22:41 -07:00
parent 46e69972c6
commit 71eacf3fad
2 changed files with 17 additions and 1 deletions

View file

@ -684,6 +684,8 @@ class EchoHooks {
$user = $wgUser;
}
$revid = $linksUpdate->getRevision() ? $linksUpdate->getRevision()->getId() : null;
// link notification is boundless as you can include infinite number of links in a page
// db insert is expensive, limit it to a reasonable amount, we can increase this limit
// once the storage is on Redis
@ -703,6 +705,7 @@ class EchoHooks {
'agent' => $user,
'extra' => array(
'link-from-page-id' => $linksUpdate->mTitle->getArticleId(),
'revid' => $revid,
)
) );
$max--;

View file

@ -34,7 +34,20 @@ class EchoPageLinkedPresentationModel extends EchoEventPresentationModel {
'icon' => 'linked',
'prioritized' => true
);
return array( $whatLinksHereLink );
$revid = $this->event->getExtraParam( 'revid' );
$diffLink = null;
if ( $revid !== null ) {
$diffLink = array(
'url' => $this->event->getTitle()->getFullURL( array( 'diff' => $revid, 'oldid' => 'prev' ) ),
'label' => $this->msg( 'notification-link-text-view-changes' )->text(),
'description' => '',
'icon' => 'changes',
'prioritized' => true
);
}
return array( $whatLinksHereLink, $diffLink );
}
protected function getHeaderMessageKey() {