Index: trunk/extensions/CodeReview/CodeRevisionAuthorLink.php |
— | — | @@ -62,12 +62,11 @@ |
63 | 63 | if ( strlen($this->mTarget) && $wgRequest->getCheck( 'newname' ) ) { |
64 | 64 | $user = User::newFromName( $this->mTarget, false ); |
65 | 65 | if( !$user || !$user->getId() ) { |
66 | | - $wgOut->addWikiMsg( 'nosuchusershort', $name ); |
| 66 | + $wgOut->addWikiMsg( 'nosuchusershort', $this->mTarget ); |
67 | 67 | return; |
68 | 68 | } |
69 | | - $this->mRepo->linkTo( $this->mAuthor, $user ); |
| 69 | + $this->mRepo->linkUser( $this->mAuthor, $user ); |
70 | 70 | $userlink = $this->mSkin->userLink( $user->getId(), $user->getName() ); |
71 | | - parent::$userLinks[$this->mAuthor] = $user; |
72 | 71 | $wgOut->addHtml( |
73 | 72 | '<div class="successbox">' . |
74 | 73 | wfMsgHtml( 'code-author-success', $this->authorLink( $this->mAuthor ), $userlink) . |
— | — | @@ -79,8 +78,7 @@ |
80 | 79 | $wgOut->addHtml( wfMsg( 'code-author-orphan' ) ); |
81 | 80 | return; |
82 | 81 | } |
83 | | - $this->mRepo->unlink( $this->mAuthor ); |
84 | | - parent::$userLinks[$this->mAuthor] = false; |
| 82 | + $this->mRepo->unlinkUser( $this->mAuthor ); |
85 | 83 | $wgOut->addHtml( |
86 | 84 | '<div class="successbox">' . |
87 | 85 | wfMsgHtml( 'code-author-unlinksuccess', $this->authorLink( $this->mAuthor ) ) . |
Index: trunk/extensions/CodeReview/CodeRepository.php |
— | — | @@ -223,7 +223,7 @@ |
224 | 224 | * @param User $user |
225 | 225 | * @return bool success |
226 | 226 | */ |
227 | | - public function linkTo( $author, User $user ) { |
| 227 | + public function linkUser( $author, User $user ) { |
228 | 228 | // We must link to an existing user |
229 | 229 | if( !$user->getId() ) { |
230 | 230 | return false; |
— | — | @@ -252,15 +252,16 @@ |
253 | 253 | __METHOD__ |
254 | 254 | ); |
255 | 255 | } |
| 256 | + self::$userLinks[$author] = $user; |
256 | 257 | return ( $dbw->affectedRows() > 0 ); |
257 | 258 | } |
258 | 259 | |
259 | 260 | /* |
260 | | - * Link the $author to the wikiuser $user |
| 261 | + * Remove local user links for $author |
261 | 262 | * @param string $author |
262 | 263 | * @return bool success |
263 | 264 | */ |
264 | | - public function unlink( $author ) { |
| 265 | + public function unlinkUser( $author ) { |
265 | 266 | $dbw = wfGetDB( DB_MASTER ); |
266 | 267 | $dbw->delete( |
267 | 268 | 'code_authors', |
— | — | @@ -270,13 +271,14 @@ |
271 | 272 | ), |
272 | 273 | __METHOD__ |
273 | 274 | ); |
| 275 | + self::$userLinks[$author] = false; |
274 | 276 | return ( $dbw->affectedRows() > 0 ); |
275 | 277 | } |
276 | 278 | |
277 | 279 | /* |
278 | | - * returns a User object if $author has a wikiuser associated, |
279 | | - * of false |
280 | | - */ |
| 280 | + * returns a User object if $author has a wikiuser associated, |
| 281 | + * or false |
| 282 | + */ |
281 | 283 | public function authorWikiUser( $author ) { |
282 | 284 | if( isset( self::$userLinks[$author] ) ) |
283 | 285 | return self::$userLinks[$author]; |