Index: trunk/extensions/CodeReview/CodeRevision.php |
— | — | @@ -44,10 +44,13 @@ |
45 | 45 | return $rev; |
46 | 46 | } |
47 | 47 | |
48 | | - static function newFromRow( $row ) { |
| 48 | + static function newFromRow( CodeRepository $repo, $row ) { |
49 | 49 | $rev = new CodeRevision(); |
50 | 50 | $rev->mRepoId = intval($row->cr_repo_id); |
51 | | - $rev->mRepo = NULL; |
| 51 | + if( $rev->mRepoId != $repo->getId() ) { |
| 52 | + throw new MWException( "Invalid repo ID in " . __METHOD__ ); |
| 53 | + } |
| 54 | + $rev->mRepo = $repo; |
52 | 55 | $rev->mId = intval($row->cr_id); |
53 | 56 | $rev->mAuthor = $row->cr_author; |
54 | 57 | $rev->mTimestamp = wfTimestamp( TS_MW, $row->cr_timestamp ); |
— | — | @@ -69,15 +72,8 @@ |
70 | 73 | return $this->mAuthor; |
71 | 74 | } |
72 | 75 | |
73 | | - function getRepo() { |
74 | | - if( !isset($this->mRepo) ) { |
75 | | - $this->mRepo = CodeRepository::newFromId( $this->mRepoId ); |
76 | | - } |
77 | | - return $this->mRepo; |
78 | | - } |
79 | | - |
80 | 76 | function getWikiUser() { |
81 | | - return $this->getRepo()->authorWikiUser( $this->getAuthor() ); |
| 77 | + return $this->mRepo->authorWikiUser( $this->getAuthor() ); |
82 | 78 | } |
83 | 79 | |
84 | 80 | function getTimestamp() { |
— | — | @@ -214,7 +210,7 @@ |
215 | 211 | $users[$user->getId()] = $user; |
216 | 212 | } |
217 | 213 | // Get repo and build comment title (for url) |
218 | | - $title = SpecialPage::getTitleFor( 'Code', $this->getRepo()->getName().'/'.$this->mId ); |
| 214 | + $title = SpecialPage::getTitleFor( 'Code', $this->mRepo->getName().'/'.$this->mId ); |
219 | 215 | $title->setFragment( "#c{$commentId}" ); |
220 | 216 | $url = $title->getFullUrl(); |
221 | 217 | foreach( $users as $userId => $user ) { |
— | — | @@ -224,7 +220,7 @@ |
225 | 221 | } |
226 | 222 | if( $user->canReceiveEmail() ) { |
227 | 223 | $user->sendMail( |
228 | | - wfMsg( 'codereview-email-subj', $this->getRepo()->getName(), $this->mId ), |
| 224 | + wfMsg( 'codereview-email-subj', $this->mRepo->getName(), $this->mId ), |
229 | 225 | wfMsg( 'codereview-email-body', $wgUser->getName(), $url, $this->mId, $text ) |
230 | 226 | ); |
231 | 227 | } |
Index: trunk/extensions/CodeReview/CodeReview.php |
— | — | @@ -99,4 +99,5 @@ |
100 | 100 | // The name of a repo which represents the code running on this wiki, used to highlight active revisions |
101 | 101 | $wgWikiSVN = 'MediaWiki'; |
102 | 102 | |
103 | | -$wgCodeReviewENotif = true; |
| 103 | +// Leave this off by default until it works right |
| 104 | +$wgCodeReviewENotif = false; |
Index: trunk/extensions/CodeReview/CodeRepository.php |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | ); |
171 | 171 | if( !$row ) |
172 | 172 | throw new MWException( 'Failed to load expected revision data' ); |
173 | | - return CodeRevision::newFromRow( $row ); |
| 173 | + return CodeRevision::newFromRow( $this, $row ); |
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |