http://www.mediawiki.org/wiki/Special:Code/MediaWiki/71209

Revision: 71209
Author:   reedy
Date:     2010-08-17 18:51:42 +0000 (Tue, 17 Aug 2010)

Log Message:
-----------
Add optional parameter to getFullUrl from r71208, to allow for #c1234

Use getFullUrl in more places

Modified Paths:
--------------
    trunk/extensions/CodeReview/backend/CodeRevision.php

Modified: trunk/extensions/CodeReview/backend/CodeRevision.php
===================================================================
--- trunk/extensions/CodeReview/backend/CodeRevision.php        2010-08-17 
18:47:31 UTC (rev 71208)
+++ trunk/extensions/CodeReview/backend/CodeRevision.php        2010-08-17 
18:51:42 UTC (rev 71209)
@@ -423,9 +423,7 @@
                                $users[0] = $watcher; // We don't have any 
anons, so using 0 is safe
                        }
                        // Get repo and build comment title (for url)
-                       $title = SpecialPage::getTitleFor( 'Code', 
$this->mRepo->getName() . '/' . $this->mId );
-                       $title->setFragment( "#c{$commentId}" );
-                       $url = $title->getFullUrl();
+                       $url = $this->getFullUrl( $commentId );
 
                        foreach ( $users as $userId => $user ) {
                                // No sense in notifying this commenter
@@ -787,8 +785,13 @@
                }
        }
        
-       public function getFullUrl() {
+       public function getFullUrl( $commentId = '' ) {
                $title = SpecialPage::getTitleFor( 'Code', 
$this->mRepo->getName() . '/' . $this->mId );
+               
+               if ( $commentId !== '' ) {
+                       $title->setFragment( "#c{$commentId}" );
+               }
+               
                return $title->getFullUrl();
        }
 
@@ -797,9 +800,7 @@
 
                if( $wgCodeReviewUDPAddress ) {
                        if( is_null( $url ) ) {
-                               $title = SpecialPage::getTitleFor( 'Code', 
$this->mRepo->getName() . '/' . $this->mId );
-                               $title->setFragment( "#c{$commentId}" );
-                               $url = $title->getFullUrl();
+                               $url = $this->getFullUrl( $commentId );
                        }
 
                        $line = wfMsg( 'code-rev-message' ) . " \00314(" . 
$this->mRepo->getName() .
@@ -814,8 +815,7 @@
                global $wgCodeReviewUDPAddress, $wgCodeReviewUDPPort, 
$wgCodeReviewUDPPrefix, $wgUser;
                
                if( $wgCodeReviewUDPAddress ) {
-                       $title = SpecialPage::getTitleFor( 'Code', 
$this->mRepo->getName() . '/' . $this->getId() );
-                       $url = $title->getFullUrl();
+                       $url = $this->getFullUrl();
 
                        $line = wfMsg( 'code-rev-status' ) . " \00314(" . 
$this->mRepo->getName() .
                                        ")\00303 " . 
RecentChange::cleanupForIRC( $wgUser->getName() ) . "\003 " .



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to