mirror of
https://github.com/flarum/core.git
synced 2025-10-19 02:36:08 +02:00
Refresh avatar display after uploading
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
use Flarum\Api\Actions\BaseAction;
|
||||
use Flarum\Core\Commands\UploadAvatarCommand;
|
||||
use Flarum\Api\Serializers\UserSerializer;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UploadAvatarAction extends BaseAction
|
||||
@@ -11,11 +12,14 @@ class UploadAvatarAction extends BaseAction
|
||||
$userId = array_get($routeParams, 'id');
|
||||
$file = $request->file('avatar');
|
||||
|
||||
$this->dispatch(
|
||||
$user = $this->dispatch(
|
||||
new UploadAvatarCommand($userId, $file, $this->actor->getUser()),
|
||||
$routeParams
|
||||
);
|
||||
|
||||
return $this->respondWithoutContent(201);
|
||||
$serializer = new UserSerializer;
|
||||
$document = $this->document()->setData($serializer->resource($user));
|
||||
|
||||
return $this->respondWithDocument($document);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user