| Index: trunk/extensions/CodeReview/tests/CodeReviewTest.php |
| — | — | @@ -41,7 +41,7 @@ |
| 42 | 42 | // $this->assertEquals( '', $formatter->link( '' ) ); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | | - public function testCommentFullUrl() { |
| | 45 | + public function testCommentCanonicalUrl() { |
| 46 | 46 | # Fixture: |
| 47 | 47 | $repo = $this->createRepo(); |
| 48 | 48 | $cr = CodeRevision::newFromSvn( $repo, array( |
| — | — | @@ -54,14 +54,14 @@ |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | 57 | # Find out our revision root URL |
| 58 | | - $baseUrl = SpecialPage::getTitleFor( 'Code', $repo->getName().'/305' )->getFullUrl(); |
| | 58 | + $baseUrl = SpecialPage::getTitleFor( 'Code', $repo->getName().'/305' )->getCanonicalUrl(); |
| 59 | 59 | |
| 60 | 60 | # Test revision URL with various comment id: |
| 61 | | - $this->assertEquals( $baseUrl, $cr->getFullUrl( '' ) ); |
| 62 | | - $this->assertEquals( $baseUrl, $cr->getFullUrl( 0 ) ); |
| 63 | | - $this->assertEquals( $baseUrl, $cr->getFullUrl( null ) ); |
| 64 | | - $this->assertEquals( $baseUrl, $cr->getFullUrl( "0" ) ); |
| 65 | | - $this->assertEquals( $baseUrl . '#c777', $cr->getFullUrl( 777 ) ); |
| 66 | | - $this->assertEquals( $baseUrl . '#c777', $cr->getFullUrl( "777" ) ); |
| | 61 | + $this->assertEquals( $baseUrl, $cr->getCanonicalUrl( '' ) ); |
| | 62 | + $this->assertEquals( $baseUrl, $cr->getCanonicalUrl( 0 ) ); |
| | 63 | + $this->assertEquals( $baseUrl, $cr->getCanonicalUrl( null ) ); |
| | 64 | + $this->assertEquals( $baseUrl, $cr->getCanonicalUrl( "0" ) ); |
| | 65 | + $this->assertEquals( $baseUrl . '#c777', $cr->getCanonicalUrl( 777 ) ); |
| | 66 | + $this->assertEquals( $baseUrl . '#c777', $cr->getCanonicalUrl( "777" ) ); |
| 67 | 67 | } |
| 68 | 68 | } |
| Index: trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php |
| — | — | @@ -118,7 +118,7 @@ |
| 119 | 119 | $dbw->commit(); |
| 120 | 120 | |
| 121 | 121 | if ( $statusChanged || $commentAdded ) { |
| 122 | | - $url = $this->mRev->getFullUrl( $commentId ); |
| | 122 | + $url = $this->mRev->getCanonicalUrl( $commentId ); |
| 123 | 123 | if ( $statusChanged && $commentAdded ) { |
| 124 | 124 | $this->mRev->emailNotifyUsersOfChanges( 'codereview-email-subj4', 'codereview-email-body4', |
| 125 | 125 | $wgUser->getName(), $this->mRev->getIdStringUnique(), $this->mRev->getOldStatus(), |
| Index: trunk/extensions/CodeReview/backend/CodeRevision.php |
| — | — | @@ -467,13 +467,13 @@ |
| 468 | 468 | ); |
| 469 | 469 | |
| 470 | 470 | // Get repo and build comment title (for url) |
| 471 | | - $url = $this->getFullUrl(); |
| | 471 | + $url = $this->getCanonicalUrl(); |
| 472 | 472 | |
| 473 | 473 | foreach ( $res as $row ) { |
| 474 | 474 | $revision = CodeRevision::newFromRow( $this->repo, $row ); |
| 475 | 475 | $users = $revision->getCommentingUsers(); |
| 476 | 476 | |
| 477 | | - $rowUrl = $revision->getFullUrl(); |
| | 477 | + $rowUrl = $revision->getCanonicalUrl(); |
| 478 | 478 | |
| 479 | 479 | $revisionAuthor = $revision->getWikiUser(); |
| 480 | 480 | |
| — | — | @@ -652,7 +652,7 @@ |
| 653 | 653 | $commentId = $dbw->insertId(); |
| 654 | 654 | $dbw->commit(); |
| 655 | 655 | |
| 656 | | - $url = $this->getFullUrl( $commentId ); |
| | 656 | + $url = $this->getCanonicalUrl( $commentId ); |
| 657 | 657 | |
| 658 | 658 | $this->sendCommentToUDP( $commentId, $text, $url ); |
| 659 | 659 | |
| — | — | @@ -1276,10 +1276,12 @@ |
| 1277 | 1277 | } |
| 1278 | 1278 | |
| 1279 | 1279 | /** |
| | 1280 | + * Get the canonical URL of a revision. Constructs a Title for this revision |
| | 1281 | + * along the lines of [[Special:Code/RepoName/12345#c678]] and calls getCanonicalUrl(). |
| 1280 | 1282 | * @param string $commentId |
| 1281 | 1283 | * @return \type |
| 1282 | 1284 | */ |
| 1283 | | - public function getFullUrl( $commentId = 0 ) { |
| | 1285 | + public function getCanonicalUrl( $commentId = 0 ) { |
| 1284 | 1286 | $title = SpecialPage::getTitleFor( 'Code', $this->repo->getName() . '/' . $this->id ); |
| 1285 | 1287 | |
| 1286 | 1288 | # Append comment id if not null, empty string or zero |
| — | — | @@ -1287,7 +1289,7 @@ |
| 1288 | 1290 | $title->setFragment( "#c{$commentId}" ); |
| 1289 | 1291 | } |
| 1290 | 1292 | |
| 1291 | | - return $title->getFullUrl(); |
| | 1293 | + return $title->getCanonicalUrl(); |
| 1292 | 1294 | } |
| 1293 | 1295 | |
| 1294 | 1296 | /** |
| — | — | @@ -1301,7 +1303,7 @@ |
| 1302 | 1304 | |
| 1303 | 1305 | if( $wgCodeReviewUDPAddress ) { |
| 1304 | 1306 | if( is_null( $url ) ) { |
| 1305 | | - $url = $this->getFullUrl( $commentId ); |
| | 1307 | + $url = $this->getCanonicalUrl( $commentId ); |
| 1306 | 1308 | } |
| 1307 | 1309 | |
| 1308 | 1310 | $line = wfMsg( 'code-rev-message' ) . " \00314(" . $this->repo->getName() . |
| — | — | @@ -1320,7 +1322,7 @@ |
| 1321 | 1323 | global $wgCodeReviewUDPAddress, $wgCodeReviewUDPPort, $wgCodeReviewUDPPrefix, $wgUser; |
| 1322 | 1324 | |
| 1323 | 1325 | if( $wgCodeReviewUDPAddress ) { |
| 1324 | | - $url = $this->getFullUrl(); |
| | 1326 | + $url = $this->getCanonicalUrl(); |
| 1325 | 1327 | |
| 1326 | 1328 | $line = wfMsg( 'code-rev-status' ) . " \00314(" . $this->repo->getName() . |
| 1327 | 1329 | ")\00303 " . RecentChange::cleanupForIRC( $wgUser->getName() ) . "\003 " . |