chore: code styling via pint

This commit is contained in:
idevakk
2025-11-14 01:51:35 -08:00
parent 3892c48ef2
commit 90ab79b3a2
121 changed files with 1003 additions and 892 deletions

View File

@@ -2,11 +2,11 @@
namespace App\Livewire\Frontend;
use Exception;
use App\Models\Email;
use App\ColorPicker;
use App\Models\Email;
use App\Models\Message;
use App\Models\ZEmail;
use Exception;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Livewire\Component;
@@ -16,12 +16,19 @@ class Mailbox extends Component
use ColorPicker;
public $messages = [];
public $deleted = [];
public $error = '';
public $email;
public $initial = false;
public $type;
public $overflow = false;
public $messageId;
protected $listeners = ['fetchMessages' => 'fetch', 'syncMailbox' => 'syncEmail', 'setMessageId' => 'setMessageId'];
@@ -30,10 +37,11 @@ class Mailbox extends Component
{
$this->email = ZEmail::getEmail();
$this->initial = false;
if (!ZEmail::getEmail()) {
if (! ZEmail::getEmail()) {
return redirect()->route('home');
}
}
public function syncEmail($email): void
{
$this->email = $email;
@@ -49,18 +57,18 @@ class Mailbox extends Component
$this->messages = [];
}
$responses = [];
if (config('app.beta_feature') || !json_decode(config('app.settings.imap_settings'))->cc_check) {
if (config('app.beta_feature') || ! json_decode(config('app.settings.imap_settings'))->cc_check) {
$responses = [
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
'cc' => [
'data' => [],
'notifications' => []
]
'notifications' => [],
],
];
} else {
$responses = [
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
'cc' => ZEmail::getMessages($this->email, 'cc', $this->deleted)
'cc' => ZEmail::getMessages($this->email, 'cc', $this->deleted),
];
}
@@ -69,7 +77,7 @@ class Mailbox extends Component
$notifications = array_merge($responses['to']['notifications'], $responses['cc']['notifications']);
if (count($notifications)) {
if (!$this->overflow && count($this->messages) == $count) {
if (! $this->overflow && count($this->messages) == $count) {
$this->overflow = true;
}
} else {
@@ -91,7 +99,8 @@ class Mailbox extends Component
$this->initial = true;
}
public function delete($messageId) {
public function delete($messageId)
{
try {
if (config('app.beta_feature')) {
@@ -103,7 +112,7 @@ class Mailbox extends Component
$this->deleted[] = $messageId;
foreach ($this->messages as $key => $message) {
if ($message['id'] == $messageId) {
$directory = public_path('tmp/attachments/') . $messageId;
$directory = public_path('tmp/attachments/').$messageId;
$this->rrmdir($directory);
unset($this->messages[$key]);
}
@@ -127,11 +136,12 @@ class Mailbox extends Component
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (is_dir($dir . DIRECTORY_SEPARATOR . $object) && !is_link($dir . "/" . $object))
$this->rrmdir($dir . DIRECTORY_SEPARATOR . $object);
else
unlink($dir . DIRECTORY_SEPARATOR . $object);
if ($object != '.' && $object != '..') {
if (is_dir($dir.DIRECTORY_SEPARATOR.$object) && ! is_link($dir.'/'.$object)) {
$this->rrmdir($dir.DIRECTORY_SEPARATOR.$object);
} else {
unlink($dir.DIRECTORY_SEPARATOR.$object);
}
}
}
rmdir($dir);