mirror of
https://github.com/flarum/core.git
synced 2025-10-22 04:06:37 +02:00
Convert the rest of the API to new action architecture
Also make some tweaks: - Merge SerializeAction::$include and SerializeAction::$includeAvailable into a keyed boolean array - Set defaults for SerializeAction::$limit and $limitMax - Rename SerializeAction::$sortAvailable to $sortFields
This commit is contained in:
@@ -8,6 +8,7 @@ use Config;
|
||||
use View;
|
||||
use DB;
|
||||
use Flarum\Forum\Events\RenderView;
|
||||
use Flarum\Api\Request as ApiRequest;
|
||||
|
||||
class IndexAction extends BaseAction
|
||||
{
|
||||
@@ -24,12 +25,13 @@ class IndexAction extends BaseAction
|
||||
'token' => Cookie::get('flarum_remember')
|
||||
];
|
||||
|
||||
$response = $this->callAction('Flarum\Api\Actions\Users\ShowAction', ['id' => $user->id]);
|
||||
$response = $response->getData();
|
||||
$response = app('Flarum\Api\Actions\Users\ShowAction')
|
||||
->handle(new ApiRequest(['id' => $user->id], $this->actor))
|
||||
->content->toArray();
|
||||
|
||||
$data = [$response->data];
|
||||
if (isset($response->included)) {
|
||||
$data = array_merge($data, $response->included);
|
||||
$data = [$response['data']];
|
||||
if (isset($response['included'])) {
|
||||
$data = array_merge($data, $response['included']);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user