mirror of
https://github.com/flarum/core.git
synced 2025-08-08 09:26:34 +02:00
Require new mail driver methods, remove BC layer
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
namespace Flarum\Mail;
|
||||
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Validation\Factory;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Swift_Transport;
|
||||
|
||||
/**
|
||||
@@ -44,14 +46,12 @@ interface DriverInterface
|
||||
* presence of validation problems with the configured mail driver, Flarum
|
||||
* will fall back to its no-op {@see \Flarum\Mail\NullDriver}.
|
||||
*/
|
||||
// TODO: Uncomment for beta.13
|
||||
//public function validate(SettingsRepositoryInterface $settings, Factory $validator): MessageBag;
|
||||
public function validate(SettingsRepositoryInterface $settings, Factory $validator): MessageBag;
|
||||
|
||||
/**
|
||||
* Does this driver actually send out emails?
|
||||
*/
|
||||
// TODO: Uncomment for beta.13
|
||||
//public function canSend(): bool;
|
||||
public function canSend(): bool;
|
||||
|
||||
/**
|
||||
* Build a mail transport based on Flarum's current settings.
|
||||
|
@@ -35,13 +35,9 @@ class MailServiceProvider extends AbstractServiceProvider
|
||||
$settings = $this->app->make(SettingsRepositoryInterface::class);
|
||||
$validator = $this->app->make(Factory::class);
|
||||
|
||||
if (method_exists($configured, 'validate')) {
|
||||
return $configured->validate($settings, $validator)->any()
|
||||
? $this->app->make(NullDriver::class)
|
||||
: $configured;
|
||||
} else {
|
||||
return $configured;
|
||||
}
|
||||
return $configured->validate($settings, $validator)->any()
|
||||
? $this->app->make(NullDriver::class)
|
||||
: $configured;
|
||||
});
|
||||
|
||||
$this->app->alias('mail.driver', DriverInterface::class);
|
||||
|
Reference in New Issue
Block a user