Catrope has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/294287

Change subject: PageLinkedPresentationModel: Use the correct title for the diff 
link
......................................................................

PageLinkedPresentationModel: Use the correct title for the diff link

Also cache the from title, because Title::newFromId() doesn't cache
its results.

Bug: T137798
Change-Id: I5df444d3dacd55fbee09e53d82ac22c77ee9e246
---
M includes/formatters/PageLinkedPresentationModel.php
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/87/294287/1

diff --git a/includes/formatters/PageLinkedPresentationModel.php 
b/includes/formatters/PageLinkedPresentationModel.php
index bc34042..c33e141 100644
--- a/includes/formatters/PageLinkedPresentationModel.php
+++ b/includes/formatters/PageLinkedPresentationModel.php
@@ -2,6 +2,8 @@
 
 class EchoPageLinkedPresentationModel extends EchoEventPresentationModel {
 
+       private $pageFrom;
+
        public function getIconType() {
                return 'linked';
        }
@@ -39,7 +41,7 @@
                $diffLink = null;
                if ( $revid !== null ) {
                        $diffLink = array(
-                               'url' => $this->event->getTitle()->getFullURL( 
array( 'diff' => $revid, 'oldid' => 'prev' ) ),
+                               'url' => $this->getPageFrom()->getFullURL( 
array( 'diff' => $revid, 'oldid' => 'prev' ) ),
                                'label' => $this->msg( 
'notification-link-text-view-changes' )->text(),
                                'description' => '',
                                'icon' => 'changes',
@@ -90,7 +92,10 @@
        }
 
        private function getPageFrom() {
-               return Title::newFromId( $this->getLinkedPageId( $this->event ) 
);
+               if ( !$this->pageFrom ) {
+                       $this->pageFrom = Title::newFromId( 
$this->getLinkedPageId( $this->event ) );
+               }
+               return $this->pageFrom;
        }
 
        protected function getSubjectMessageKey() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5df444d3dacd55fbee09e53d82ac22c77ee9e246
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

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

Reply via email to