Mail-Routing: API-Einlieferung ueber Status-Log-Quelle erkennen
Der Kontotyp ist kein verlaesslicher Marker (connektar ist agency,
nicht apiuser) — submitForReview traegt jetzt die Quelle ('customer'
Panel, 'api' Legacy/v1) ins Status-Log, notifyAuthor prueft den
letzten Review-Uebergang. Kein Schema-Change noetig.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
2820385651
commit
00f67c4e54
3 changed files with 16 additions and 7 deletions
|
|
@ -5,7 +5,6 @@ namespace App\Services\PressRelease;
|
|||
use App\Enums\EmailNotificationType;
|
||||
use App\Enums\PressReleaseClassification;
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Enums\RegistrationType;
|
||||
use App\Enums\SinglePurchaseStatus;
|
||||
use App\Jobs\ClassifyPressRelease;
|
||||
use App\Jobs\ScorePressRelease;
|
||||
|
|
@ -35,7 +34,12 @@ class PressReleaseService
|
|||
{
|
||||
public function __construct(private readonly BlacklistService $blacklist) {}
|
||||
|
||||
public function submitForReview(PressRelease $pressRelease): void
|
||||
/**
|
||||
* @param string $source Einlieferungsweg fuers Status-Log ('customer'
|
||||
* = Panel, 'api' = Legacy-/v1-API) — steuert u. a.
|
||||
* das Mail-Routing (API → Pressekontakt/Firma).
|
||||
*/
|
||||
public function submitForReview(PressRelease $pressRelease, string $source = 'customer'): void
|
||||
{
|
||||
$this->assertStatus($pressRelease, [PressReleaseStatus::Draft, PressReleaseStatus::Rejected]);
|
||||
|
||||
|
|
@ -84,7 +88,7 @@ class PressReleaseService
|
|||
'status' => PressReleaseStatus::Review->value,
|
||||
'withdrawal_waiver_consented_at' => now(),
|
||||
]);
|
||||
$this->logStatusChange($pressRelease, $previous, PressReleaseStatus::Review, null, 'customer');
|
||||
$this->logStatusChange($pressRelease, $previous, PressReleaseStatus::Review, null, $source);
|
||||
|
||||
// Versionierter Audit-Trail der KI-Deklaration: jeder Submit erzeugt
|
||||
// einen neuen, unveränderlichen Eintrag (Abs.-50-Verteidigung —
|
||||
|
|
@ -491,9 +495,14 @@ class PressReleaseService
|
|||
|
||||
// API-Einlieferer (z. B. connektar) nicht zuspammen (Entscheidung
|
||||
// 10.07.2026): Statt-Mail an den Pressekontakt der PM, sonst an die
|
||||
// Firmen-E-Mail; nur ohne beides an den Einlieferer selbst.
|
||||
// Firmen-E-Mail; nur ohne beides an den Einlieferer selbst. Marker
|
||||
// ist die Quelle des letzten Review-Uebergangs im Status-Log — der
|
||||
// Kontotyp ist nicht verlaesslich (connektar ist z. B. 'agency').
|
||||
$recipient = $user->email;
|
||||
$isApiSubmitter = $user->registration_type === RegistrationType::ApiUser;
|
||||
$isApiSubmitter = $pressRelease->statusLogs()
|
||||
->where('to_status', PressReleaseStatus::Review->value)
|
||||
->orderByDesc('id')
|
||||
->value('source') === 'api';
|
||||
|
||||
if ($isApiSubmitter) {
|
||||
// Scope-frei auflösen: der Mail-Versand läuft auch aus Jobs/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue