diff --git a/app/Mailman/Actions/SettingIndexAction.php b/app/Mailman/Actions/SettingIndexAction.php index ae8cacf3..e1dd093d 100644 --- a/app/Mailman/Actions/SettingIndexAction.php +++ b/app/Mailman/Actions/SettingIndexAction.php @@ -31,7 +31,7 @@ class SettingIndexAction session()->put('title', 'Mailman-Einstellungen'); $state = $settings->base_url && $settings->username && $settings->password && $settings->is_active - ? app(MailmanService::class)->setCredentials($settings->base_url, $settings->username, $settings->password)->check() + ? app(MailmanService::class)->fromSettings($settings)->check() : null; return Inertia::render('setting/Mailman', [ diff --git a/app/Mailman/Support/MailmanService.php b/app/Mailman/Support/MailmanService.php index 1787e5f1..fdfdaba0 100644 --- a/app/Mailman/Support/MailmanService.php +++ b/app/Mailman/Support/MailmanService.php @@ -4,6 +4,7 @@ namespace App\Mailman\Support; use App\Mailman\Data\MailingList; use App\Mailman\Exceptions\MailmanServiceException; +use App\Mailman\MailmanSettings; use Illuminate\Http\Client\ConnectionException; use Illuminate\Http\Client\PendingRequest; use Illuminate\Support\Facades\Http; @@ -25,6 +26,11 @@ class MailmanService return $this; } + public function fromSettings(MailmanSettings $settings): self + { + return $this->setCredentials($settings->base_url, $settings->username, $settings->password); + } + public function check(): bool { try {