mirror of
https://github.com/friendica/friendica
synced 2025-01-09 21:24:44 +00:00
Apply suggestions
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
9c6f6bcb95
commit
0209892631
2 changed files with 7 additions and 1 deletions
|
@ -358,14 +358,18 @@ class Group
|
||||||
throw new HTTPException\NotFoundException('Group not found.');
|
throw new HTTPException\NotFoundException('Group not found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$contactIds = [];
|
||||||
|
|
||||||
foreach ($contacts as $cid) {
|
foreach ($contacts as $cid) {
|
||||||
$cdata = Contact::getPublicAndUserContactID($cid, $group['uid']);
|
$cdata = Contact::getPublicAndUserContactID($cid, $group['uid']);
|
||||||
if (empty($cdata['user'])) {
|
if (empty($cdata['user'])) {
|
||||||
throw new HTTPException\NotFoundException('Invalid contact.');
|
throw new HTTPException\NotFoundException('Invalid contact.');
|
||||||
}
|
}
|
||||||
|
|
||||||
DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $cdata['user']]);
|
$contactIds[] = $cdata['user'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $contactIds]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,6 +45,7 @@ class Accounts extends BaseApi
|
||||||
if (empty($request['account_ids']) || empty($this->parameters['id'])) {
|
if (empty($request['account_ids']) || empty($this->parameters['id'])) {
|
||||||
DI::mstdnError()->UnprocessableEntity();
|
DI::mstdnError()->UnprocessableEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Group::removeMembers($this->parameters['id'], $request['account_ids']);
|
return Group::removeMembers($this->parameters['id'], $request['account_ids']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +60,7 @@ class Accounts extends BaseApi
|
||||||
if (empty($request['account_ids']) || empty($this->parameters['id'])) {
|
if (empty($request['account_ids']) || empty($this->parameters['id'])) {
|
||||||
DI::mstdnError()->UnprocessableEntity();
|
DI::mstdnError()->UnprocessableEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Group::addMembers($this->parameters['id'], $request['account_ids']);
|
return Group::addMembers($this->parameters['id'], $request['account_ids']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue