]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apigroupprofileupdate.php
Don't send multiple error responses in ApiMediaUpload :)
[quix0rs-gnu-social.git] / actions / apigroupprofileupdate.php
index 9a4592f423db60fed7093116aaa95b735d8926b2..1a489eeefb25e749cbfce5dedd94367797c2808d 100644 (file)
@@ -55,7 +55,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
     {
         parent::prepare($args);
 
-        $this->nickname    = common_canonical_nickname($this->trimmed('nickname'));
+        $this->nickname    = Nickname::normalize($this->trimmed('nickname'));
 
         $this->fullname    = $this->trimmed('fullname');
         $this->homepage    = $this->trimmed('homepage');
@@ -106,14 +106,9 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
 
         try {
 
-            if (!empty($this->nickname)) {
+            if (common_config('profile', 'changenick') == true && $this->group->nickname !== $this->nickname) {
                 try {
                     $this->group->nickname = Nickname::normalize($this->nickname, true);
-                } catch (NicknameTakenException $e) {
-                    // Abort only if the nickname is occupied by _another_ local group
-                    if ($e->profile->id != $this->group->id) {
-                        throw new ApiValidationException($e->getMessage());
-                    }
                 } catch (NicknameException $e) {
                     throw new ApiValidationException($e->getMessage());
                 }