(bug 27862; follow-up r77714) Make emailuser api module not freak out when SpecialEma...
authorBrian Wolff <bawolff@users.mediawiki.org>
Sat, 5 Mar 2011 03:35:49 +0000 (03:35 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Sat, 5 Mar 2011 03:35:49 +0000 (03:35 +0000)
RELEASE-NOTES
includes/api/ApiEmailUser.php
includes/specials/SpecialEmailuser.php

index 513e299..9c92368 100644 (file)
@@ -203,6 +203,7 @@ PHP if you have not done so prior to upgrading MediaWiki.
 * (bug 27688) Simplify queries to list user block information
 * (bug 27708) list=users does not have a property to return user id
 * (bug 27715) imageinfo didn't respect revdelete
+* (bug 27862) Useremail module didn't properly return success on success.
 
 === Languages updated in 1.18 ===
 
index 2c7df4e..55188b9 100644 (file)
@@ -63,6 +63,17 @@ class ApiEmailUser extends ApiBase {
                        'CCMe' => $params['ccme'],
                );
                $retval = SpecialEmailUser::submit( $data );
+
+               if ( $retval instanceof Status ) {
+                       // SpecialEmailUser sometimes returns a status
+                       // sometimes it doesn't.
+                       if ( $retval->isGood() ) {
+                               $retval = true;
+                       } else {
+                               $retval = $retval->getErrorsArray();
+                       }
+               }
+
                if ( $retval === true ) {
                        $result = array( 'result' => 'Success' );
                } else {
index 77c91de..6127122 100644 (file)
@@ -221,7 +221,8 @@ class SpecialEmailUser extends UnlistedSpecialPage {
         * getPermissionsError(). It is probably also a good 
         * idea to check the edit token and ping limiter in advance.
         *
-        * @return Mixed: True on success, String on error
+        * @return Mixed: Status object, or potentially a String on error
+        * or maybe even true on success if anything uses the EmailUser hook.
         */
        public static function submit( $data ) {
                global $wgUser, $wgUserEmailUseReplyTo;