r46546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46545‎ | r46546 | r46547 >
Date:19:27, 29 January 2009
Author:btongminh
Status:ok (Comments)
Tags:
Comment:
Kill code duplication & other style tweaks
Modified paths:
  • /trunk/phase3/includes/api/ApiEmailUser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiEmailUser.php
@@ -52,21 +52,21 @@
5353 $this->dieUsageMsg( array( 'missingparam', 'target' ) );
5454 // Validate target
5555 $targetUser = EmailUserForm::validateEmailTarget( $params['target'] );
56 - if( isset( $params['check'] ) )
57 - if($targetUser instanceof User) {
 56+ if ( isset( $params['check'] ) ) {
 57+ // Only a check was requested; don't actually send a mail
 58+ if ( $targetUser instanceof User )
5859 $result = array( 'result' => 'Enabled' );
59 - $this->getResult()->addValue( null, $this->getModuleName(), $result );
60 - return;
61 - }
62 - else {
 60+ else
6361 $result = array( 'result' => 'Disabled' );
64 - $this->getResult()->addValue( null, $this->getModuleName(), $result );
65 - return;
66 - }
 62+
 63+ $this->getResult()->addValue( null, $this->getModuleName(), $result );
 64+ return;
 65+ }
 66+ // If $targetUser is not a User it represents an error message
6767 if ( !( $targetUser instanceof User ) )
6868 $this->dieUsageMsg( array( $targetUser ) );
6969
70 - //Check more parameters
 70+ // Check more parameters
7171 if ( !isset( $params['text'] ) )
7272 $this->dieUsageMsg( array( 'missingparam', 'text' ) );
7373 if ( !isset( $params['token'] ) )
@@ -110,7 +110,7 @@
111111 'text' => 'Mail body',
112112 'token' => 'A token previously acquired via prop=info',
113113 'ccme' => 'Send a copy of this mail to me',
114 - 'check' => 'Check if the user has email enabled',
 114+ 'check' => 'Only check whether the user has email enabled',
115115 );
116116 }
117117

Comments

#Comment by Werdna (talk | contribs)   23:16, 11 February 2009

Looks okay.

Status & tagging log