Superflous spaces

This commit is contained in:
Michael 2022-01-16 07:14:09 +00:00
parent c55c42b303
commit 8ff2cc3976
8 changed files with 35 additions and 36 deletions

View file

@ -53,33 +53,33 @@ class Create extends BaseApi
$this->dba = $dba;
$this->friendicaGroup = $friendicaGroup;
}
protected function rawContent(array $request = [])
{
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
$uid = BaseApi::getCurrentUserID();
// params
$name = $_REQUEST['name'] ?? '';
if ($name == '') {
throw new HTTPException\BadRequestException('group name not specified');
}
// error message if specified group name already exists
if ($this->dba->exists('group', ['uid' => $uid, 'name' => $name, 'deleted' => false])) {
throw new HTTPException\BadRequestException('group name already exists');
}
$ret = Group::create($uid, $name);
if ($ret) {
$gid = Group::getIdByName($uid, $name);
} else {
throw new HTTPException\BadRequestException('other API error');
}
$grp = $this->friendicaGroup->createFromId($gid);
$this->response->exit('statuses', ['lists' => ['lists' => $grp]], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}