From 927f6e3c9bb1108d8cf96c39ca728b9f4d70e433 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 19 May 2015 09:26:39 +0930 Subject: [PATCH] Fix errors in DeleteAvatarAction/Command --- .../src/Api/Actions/Users/DeleteAvatarAction.php | 2 +- framework/core/src/Core/CoreServiceProvider.php | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/framework/core/src/Api/Actions/Users/DeleteAvatarAction.php b/framework/core/src/Api/Actions/Users/DeleteAvatarAction.php index 7d1f534a1..9e841e3c1 100644 --- a/framework/core/src/Api/Actions/Users/DeleteAvatarAction.php +++ b/framework/core/src/Api/Actions/Users/DeleteAvatarAction.php @@ -41,7 +41,7 @@ class DeleteAvatarAction extends SerializeResourceAction protected function data(JsonApiRequest $request, JsonApiResponse $response) { return $this->bus->dispatch( - new DeleteAvatarCommand($request->get('id'), $this->actor->getUser()) + new DeleteAvatarCommand($request->get('id'), $request->actor->getUser()) ); } } diff --git a/framework/core/src/Core/CoreServiceProvider.php b/framework/core/src/Core/CoreServiceProvider.php index c65f70cfd..e91d3ec89 100644 --- a/framework/core/src/Core/CoreServiceProvider.php +++ b/framework/core/src/Core/CoreServiceProvider.php @@ -78,11 +78,17 @@ class CoreServiceProvider extends ServiceProvider 'Flarum\Core\Repositories\EloquentActivityRepository' ); + $avatarFilesystem = function (Container $app) { + return $app->make('Illuminate\Contracts\Filesystem\Factory')->disk('flarum-avatars')->getDriver(); + }; + $this->app->when('Flarum\Core\Handlers\Commands\UploadAvatarCommandHandler') ->needs('League\Flysystem\FilesystemInterface') - ->give(function (Container $app) { - return $app->make('Illuminate\Contracts\Filesystem\Factory')->disk('flarum-avatars')->getDriver(); - }); + ->give($avatarFilesystem); + + $this->app->when('Flarum\Core\Handlers\Commands\DeleteAvatarCommandHandler') + ->needs('League\Flysystem\FilesystemInterface') + ->give($avatarFilesystem); } public function registerGambits()