mirror of
https://github.com/friendica/friendica
synced 2025-04-24 07:50:11 +00:00
Superflous spaces
This commit is contained in:
parent
c55c42b303
commit
8ff2cc3976
8 changed files with 35 additions and 36 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,29 +53,29 @@ class Destroy extends BaseApi
|
|||
$this->dba = $dba;
|
||||
$this->friendicaGroup = $friendicaGroup;
|
||||
}
|
||||
|
||||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
|
||||
// params
|
||||
$gid = $_REQUEST['list_id'] ?? 0;
|
||||
|
||||
|
||||
// error if no gid specified
|
||||
if ($gid == 0) {
|
||||
throw new HTTPException\BadRequestException('gid not specified');
|
||||
}
|
||||
|
||||
|
||||
// get data of the specified group id
|
||||
$group = $this->dba->selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
|
||||
// error message if specified gid is not in database
|
||||
if (!$group) {
|
||||
throw new HTTPException\BadRequestException('gid not available');
|
||||
}
|
||||
|
||||
|
||||
$list = $this->friendicaGroup->createFromId($gid);
|
||||
|
||||
|
||||
if (Group::remove($gid)) {
|
||||
$this->response->exit('statuses', ['lists' => ['lists' => $list]], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
||||
}
|
||||
|
|
|
@ -55,9 +55,9 @@ class Ownership extends BaseApi
|
|||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
|
||||
$groups = $this->dba->select('group', [], ['deleted' => false, 'uid' => $uid]);
|
||||
|
||||
|
||||
// loop through all groups
|
||||
$lists = [];
|
||||
foreach ($groups as $group) {
|
||||
|
|
|
@ -54,7 +54,7 @@ class Statuses extends BaseApi
|
|||
$this->dba = $dba;
|
||||
$this->twitterStatus = $twitterStatus;
|
||||
}
|
||||
|
||||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
|
|
|
@ -58,26 +58,26 @@ class Update extends BaseApi
|
|||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
|
||||
// params
|
||||
$gid = $_REQUEST['list_id'] ?? 0;
|
||||
$name = $_REQUEST['name'] ?? '';
|
||||
|
||||
|
||||
// error if no gid specified
|
||||
if ($gid == 0) {
|
||||
throw new HTTPException\BadRequestException('gid not specified');
|
||||
}
|
||||
|
||||
|
||||
// get data of the specified group id
|
||||
$group = $this->dba->selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
|
||||
// error message if specified gid is not in database
|
||||
if (!$group) {
|
||||
throw new HTTPException\BadRequestException('gid not available');
|
||||
}
|
||||
|
||||
|
||||
if (Group::update($gid, $name)) {
|
||||
$list = $this->friendicaGroup->createFromId($gid);
|
||||
|
||||
|
||||
$this->response->exit('statuses', ['lists' => ['lists' => $list]], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue