API: Parameter cleanup

This commit is contained in:
Michael 2021-05-19 06:18:42 +00:00
parent 453e6a9d75
commit e3d227f3c9
22 changed files with 147 additions and 80 deletions

View file

@ -57,15 +57,18 @@ class Lists extends BaseApi
self::login(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
$title = $_REQUEST['title'] ?? '';
if (empty($title)) {
$request = self::getRequest([
'title' => '',
]);
if (empty($request['title'])) {
DI::mstdnError()->UnprocessableEntity();
}
Group::create($uid, $title);
Group::create($uid, $request['title']);
$id = Group::getIdByName($uid, $title);
$id = Group::getIdByName($uid, $request['title']);
if (!$id) {
DI::mstdnError()->InternalError();
}