Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: remove livewire legacy from help view

Andras Bacsai8c9989136ba8
diff --git a/app/Livewire/Help.php b/app/Livewire/Help.php
index 934e816614..b174b14297 100644
--- a/app/Livewire/Help.php
+++ b/app/Livewire/Help.php
@@ -5,55 +5,39 @@ namespace App\Livewire;
use DanHarrin\LivewireRateLimiting\WithRateLimiting;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Http;
-use Illuminate\Support\Facades\Route;
+use Livewire\Attributes\Rule;
use Livewire\Component;
class Help extends Component
{
use WithRateLimiting;
+ #[Rule(['required', 'min:10', 'max:1000'])]
public string $description;
+ #[Rule(['required', 'min:3'])]
public string $subject;
- public ?string $path = null;
-
- protected $rules = [
- 'description' => 'required|min:10',
- 'subject' => 'required|min:3',
- ];
-
- public function mount()
- {
- $this->path = Route::current()?->uri() ?? null;
- if (isDev()) {
- $this->description = "I'm having trouble with {$this->path}";
- $this->subject = "Help with {$this->path}";
- }
- }
-
public function submit()
{
try {
- $this->rateLimit(3, 30);
$this->validate();
- $debug = "Route: {$this->path}";
+ $this->rateLimit(3, 30);
+
+ $settings = instanceSettings();
$mail = new MailMessage;
$mail->view(
'emails.help',
[
'description' => $this->description,
- 'debug' => $debug,
]
);
$mail->subject("[HELP]: {$this->subject}");
- $settings = instanceSettings();
$type = set_transanctional_email_settings($settings);
- if (! $type) {
+
+ // Sending feedback through Cloud API
+ if ($type === false) {
$url = 'https://app.coolify.io/api/feedback';
- if (isDev()) {
- $url = 'http://localhost:80/api/feedback';
- }
Http::post($url, [
'content' => 'User: `'.auth()->user()?->email.'` with subject: `'.$this->subject.'` has the following problem: `'.$this->description.'`',
]);
diff --git a/app/View/Components/Forms/Input.php b/app/View/Components/Forms/Input.php
index fbd7b0b158..7283ef20f8 100644
--- a/app/View/Components/Forms/Input.php
+++ b/app/View/Components/Forms/Input.php
@@ -23,6 +23,8 @@ class Input extends Component
public bool $isMultiline = false,
public string $defaultClass = 'input',
public string $autocomplete = 'off',
+ public ?int $minlength = null,
+ public ?int $maxlength = null,
) {}
public function render(): View|Closure|string
diff --git a/resources/views/emails/help.blade.php b/resources/views/emails/help.blade.php
index a9f8aeb697..6e7abba2c0 100644
--- a/resources/views/emails/help.blade.php
+++ b/resources/views/emails/help.blade.php
@@ -2,4 +2,4 @@
{{ Illuminate\Mail\Markdown::parse('---') }}
-{{ Illuminate\Mail\Markdown::parse($debug) }}
+{{-- {{ Illuminate\Mail\Markdown::parse($debug) }} --}}
diff --git a/resources/views/livewire/help.blade.php b/resources/views/livewire/help.blade.php
index 0b79d3bd62..dea6ca46c9 100644
--- a/resources/views/livewire/help.blade.php
+++ b/resources/views/livewire/help.blade.php
@@ -1,10 +1,11 @@
<div class="flex flex-col w-full gap-2">
<div>Your feedback helps us to improve Coolify. Thank you! 💜</div>
<form wire:submit="submit" class="flex flex-col gap-4 pt-4">
- <x-forms.input id="subject" label="Subject" placeholder="Summary of your problem."></x-forms.input>
- <x-forms.textarea rows="10" id="description" label="Description" class="font-sans" spellcheck
- placeholder="Please provide as much information as possible."></x-forms.textarea>
+ <x-forms.input minlength="3" required id="subject" label="Subject" placeholder="Help with..."></x-forms.input>
+ <x-forms.textarea minlength="10" maxlength="1000" required rows="10" id="description" label="Description"
+ class="font-sans" spellcheck
+ placeholder="Having trouble with... Please provide as much information as possible."></x-forms.textarea>
<div></div>
- <x-forms.button class="w-full mt-4" type="submit" @click="modalOpen=false">Send</x-forms.button>
+ <x-forms.button class="w-full mt-4" type="submit">Send</x-forms.button>
</form>
</div>