Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions app/Console/Commands/SetInboundForDropboxMails.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

namespace App\Console\Commands;

use App\Models\DropboxMail;
use App\Models\Tenant;
use Illuminate\Console\Command;

class SetInboundForDropboxMails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'dropbox:inbound {--tenant= : Optional tenant ID to process only one tenant}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Create recurring invoices that are due today';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Falsche Command-Beschreibung.

Die Beschreibung lautet "Create recurring invoices that are due today", aber der Befehl klassifiziert Dropbox-Mails als eingehend. Dies ist ein Copy-Paste-Fehler.

🐛 Vorgeschlagene Korrektur
-    protected $description = 'Create recurring invoices that are due today';
+    protected $description = 'Set is_inbound for dropbox mails based on sender address';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
protected $description = 'Create recurring invoices that are due today';
protected $description = 'Set is_inbound for dropbox mails based on sender address';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/Console/Commands/SetInboundForDropboxMails.php` at line 23, Update the
$description property in SetInboundForDropboxMails to accurately describe that
the command classifies Dropbox mails as inbound, replacing the copied
recurring-invoice description.


/**
* Execute the console command.
*/
public function handle()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Rückgabetyp für handle() fehlt.

Die Methode handle() hat keine explizite Rückgabetypdeklaration. Gemäß den Coding-Guidelines müssen alle PHP-Methoden explizite Rückgabetypen haben.

♻️ Vorgeschlagene Korrektur
-    public function handle()
+    public function handle(): int
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public function handle()
public function handle(): int
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/Console/Commands/SetInboundForDropboxMails.php` at line 28, Füge der
Methode handle() in SetInboundForDropboxMails eine explizite
Rückgabetypdeklaration hinzu. Verwende den Rückgabetyp, der dem tatsächlich
zurückgegebenen Wert und dem bestehenden Laravel-Command-Vertrag entspricht.

Source: Coding guidelines

{
$tenantId = $this->option('tenant');

if ($tenantId) {
$tenant = Tenant::find($tenantId);
if (! $tenant) {
$this->error("Tenant {$tenantId} not found");

return 1;
}
$this->processTenant($tenant);
} else {
$tenants = Tenant::all();
$this->info('Processing '.count($tenants).' tenants...');

foreach ($tenants as $tenant) {
$this->processTenant($tenant);
}
}

return 0;
}

private function processTenant(Tenant $tenant): void
{
$tenant->run(function () {
$mails = DropboxMail::query()->with('dropbox')->get();

foreach ($mails as $mail) {
$mail->is_inbound = $mail->dropbox->real_email !== $mail->from;
$mail->save();
}
});
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/App/EmailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function index(Dropbox $dropbox, $mail = null): Response
false)->with('mails')->orderBy('name')->orderBy('first_name')->get();
$projects = Project::query()->where('is_archived', false)->orderBy('name')->get();

$mails = DropboxMail::query()->whereNull('archived_at')->withCount('attachments')->where('dropbox_id', $dropbox->id)->orderBy('date', 'desc')->paginate(50);
$mails = DropboxMail::query()->where('is_inbound', true)->whereNull('archived_at')->withCount('attachments')->where('dropbox_id', $dropbox->id)->orderBy('date', 'desc')->paginate(50);

return Inertia::render('App/Email/EmailIndex', [
'mails' => DropboxMailData::collect($mails),
Expand Down
11 changes: 9 additions & 2 deletions resources/js/Pages/App/Email/EmailIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,14 @@ const EmailIndex: React.FC<InboxIndexProps> = ({ contacts, dropbox, mail, mails,
width="full"
className="relative m-0 mx-0 h-full p-0 px-0"
>
<div className="absolute top-0 bottom-0 w-96 border-r">
<div className="absolute top-0 bottom-0 w-68 border-r">
Posteingang
<br />
Gesendete Objekte
<br />
Archiv
</div>
Comment on lines +126 to +132

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Seitenleiste ohne semantische Struktur und Interaktivität.

Die Kategorien sind als reiner Text mit <br />-Trennern implementiert. Das ist weder semantisch (keine <nav>/<ul>/<li>-Struktur) noch interaktiv (keine Klick-Handler, keine aktiven Zustände, keine Routing-Anbindung). Für Screenreader ist die Navigation nicht erfassbar.

♻️ Vorschlag: semantische Navigation mit Buttons
-      <div className="absolute top-0 bottom-0 w-68 border-r">
-        Posteingang
-        <br />
-        Gesendete Objekte
-        <br />
-        Archiv
-      </div>
+      <nav className="absolute top-0 bottom-0 w-68 border-r">
+        <ul className="flex flex-col gap-1 p-4">
+          <li>
+            <button
+              type="button"
+              className="w-full rounded-md px-3 py-2 text-left text-sm font-medium hover:bg-accent"
+            >
+              Posteingang
+            </button>
+          </li>
+          <li>
+            <button
+              type="button"
+              className="w-full rounded-md px-3 py-2 text-left text-sm font-medium hover:bg-accent"
+            >
+              Gesendete Objekte
+            </button>
+          </li>
+          <li>
+            <button
+              type="button"
+              className="w-full rounded-md px-3 py-2 text-left text-sm font-medium hover:bg-accent"
+            >
+              Archiv
+            </button>
+          </li>
+        </ul>
+      </nav>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="absolute top-0 bottom-0 w-68 border-r">
Posteingang
<br />
Gesendete Objekte
<br />
Archiv
</div>
<nav className="absolute top-0 bottom-0 w-68 border-r">
<ul className="flex flex-col gap-1 p-4">
<li>
<button
type="button"
className="w-full rounded-md px-3 py-2 text-left text-sm font-medium hover:bg-accent"
>
Posteingang
</button>
</li>
<li>
<button
type="button"
className="w-full rounded-md px-3 py-2 text-left text-sm font-medium hover:bg-accent"
>
Gesendete Objekte
</button>
</li>
<li>
<button
type="button"
className="w-full rounded-md px-3 py-2 text-left text-sm font-medium hover:bg-accent"
>
Archiv
</button>
</li>
</ul>
</nav>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@resources/js/Pages/App/Email/EmailIndex.tsx` around lines 126 - 132, Ersetze
den reinen Textblock mit <br />-Trennern durch eine semantische Navigation mit
<nav>, <ul> und <li>. Rendere jede Kategorie als interaktives Button- oder
Link-Element, binde die Auswahl an die bestehende Zustands- oder Routinglogik an
und kennzeichne den aktuell aktiven Eintrag barrierefrei.

<div className="absolute top-0 bottom-0 left-68 w-96 border-r">
<div className="h-full overflow-y-auto">
<div className="flex flex-col gap-2 p-4">
{mails.data.map(item => (
Expand All @@ -137,7 +144,7 @@ const EmailIndex: React.FC<InboxIndexProps> = ({ contacts, dropbox, mail, mails,
</div>
</div>
</div>
<div className="absolute top-0 right-0 bottom-0 left-96 flex">
<div className="absolute top-0 right-0 bottom-0 left-164 flex">
<div className="mx-auto h-full overflow-y-auto">
{mail && <Email mail={mail} contacts={contacts} projects={projects} />}
</div>
Expand Down
Loading