summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-05-07 00:52:54 -0700
committerZach Copley <zach@status.net>2010-05-07 10:10:30 -0700
commit06a63b0404aa96efc1118563482c11567b048961 (patch)
tree343ae0947c3d71704378483174ce8cd3bf64cb9a
parentb407665b983297078f5361db24c60a7d46e0f4ba (diff)
Finish api/statusnet/groups/update
-rw-r--r--actions/apigroupprofileupdate.php19
-rw-r--r--lib/apiaction.php2
2 files changed, 10 insertions, 11 deletions
diff --git a/actions/apigroupprofileupdate.php b/actions/apigroupprofileupdate.php
index 0d3620c26..6ac4b5a4b 100644
--- a/actions/apigroupprofileupdate.php
+++ b/actions/apigroupprofileupdate.php
@@ -33,8 +33,6 @@ if (!defined('STATUSNET')) {
require_once INSTALLDIR . '/lib/apiauth.php';
-class ApiValidationException extends Exception { }
-
/**
* API analog to the group edit page
*
@@ -62,6 +60,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
parent::prepare($args);
$this->nickname = common_canonical_nickname($this->trimmed('nickname'));
+
$this->fullname = $this->trimmed('fullname');
$this->homepage = $this->trimmed('homepage');
$this->description = $this->trimmed('description');
@@ -172,12 +171,12 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
$this->serverError(_('Could not update group.'));
}
- $aliases = null;
+ $aliases = array();
try {
- if (!empty($this->aliasstring)) {
- $aliases = $this->parseAliases();
+ if (!empty($this->aliasstring)) {
+ $aliases = $this->validateAliases();
}
} catch (ApiValidationException $ave) {
@@ -195,7 +194,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
$this->serverError(_('Could not create aliases.'));
}
- if (!empty($this->nickname) && $this->nickname != $orig->nickname) {
+ if (!empty($this->nickname) && ($this->nickname != $orig->nickname)) {
common_log(LOG_INFO, "Saving local group info.");
$local = Local_group::staticGet('group_id', $this->group->id);
$local->setNickname($this->nickname);
@@ -260,6 +259,8 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
_('Not a valid nickname.')
);
}
+
+ return true;
}
function validateHomepage()
@@ -319,10 +320,6 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
)
);
- if (empty($aliases)) {
- $aliases = array();
- }
-
if (count($aliases) > common_config('group', 'maxaliases')) {
throw new ApiValidationException(
sprintf(
@@ -357,7 +354,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
}
// XXX assumes alphanum nicknames
- if (strcmp($alias, $nickname) == 0) {
+ if (strcmp($alias, $this->nickname) == 0) {
throw new ApiValidationException(
_('Alias can\'t be the same as nickname.')
);
diff --git a/lib/apiaction.php b/lib/apiaction.php
index 42aa08ef7..d35391d4e 100644
--- a/lib/apiaction.php
+++ b/lib/apiaction.php
@@ -97,6 +97,8 @@ if (!defined('STATUSNET')) {
exit(1);
}
+class ApiValidationException extends Exception { }
+
/**
* Contains most of the Twitter-compatible API output functions.
*