mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 23:23:52 +08:00
- FilesystemInterface no longer needed in User related handlers
- FilesystemInterface conditional ioc binding moved to AvatarUploader - User::getAvatarAtribute failed to use the UrlGenerator properly
This commit is contained in:
parent
3f7b51cf24
commit
033961844d
|
@ -98,7 +98,7 @@ class UploadAvatarHandler
|
||||||
$image = (new ImageManager)->make($tmpFile);
|
$image = (new ImageManager)->make($tmpFile);
|
||||||
|
|
||||||
$this->events->fire(
|
$this->events->fire(
|
||||||
new AvatarSaving($user, $actor, $tmpFile)
|
new AvatarSaving($user, $actor, $image)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->uploader->upload($user, $image);
|
$this->uploader->upload($user, $image);
|
||||||
|
|
|
@ -316,7 +316,7 @@ class User extends AbstractModel
|
||||||
return $this->avatar_path;
|
return $this->avatar_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
return app(UrlGenerator::class)->toPath('assets/avatars/'.$this->avatar_path);
|
return app(UrlGenerator::class)->to('forum')->path('assets/avatars/'.$this->avatar_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,15 +41,7 @@ class UserServiceProvider extends AbstractServiceProvider
|
||||||
return $app->make('Illuminate\Contracts\Filesystem\Factory')->disk('flarum-avatars')->getDriver();
|
return $app->make('Illuminate\Contracts\Filesystem\Factory')->disk('flarum-avatars')->getDriver();
|
||||||
};
|
};
|
||||||
|
|
||||||
$this->app->when('Flarum\User\Command\UploadAvatarHandler')
|
$this->app->when(AvatarUploader::class)
|
||||||
->needs('League\Flysystem\FilesystemInterface')
|
|
||||||
->give($avatarsFilesystem);
|
|
||||||
|
|
||||||
$this->app->when(Command\DeleteAvatarHandler::class)
|
|
||||||
->needs('League\Flysystem\FilesystemInterface')
|
|
||||||
->give($avatarsFilesystem);
|
|
||||||
|
|
||||||
$this->app->when(Command\RegisterUserHandler::class)
|
|
||||||
->needs('League\Flysystem\FilesystemInterface')
|
->needs('League\Flysystem\FilesystemInterface')
|
||||||
->give($avatarsFilesystem);
|
->give($avatarsFilesystem);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user