@@ -18,6 +18,11 @@ final class LegacyContent
|
||||
{
|
||||
public function available(): bool
|
||||
{
|
||||
// Explicit delivery gate; document publication and access checks remain independent.
|
||||
if (config('portal.legacy_content_enabled', false)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! config('portal.legacy_content_qa_enabled') || ! app()->environment('testing')
|
||||
|| config('database.connections.pgsql.host') !== '127.0.0.1'
|
||||
|| config('database.connections.pgsql.url') || (int) config('database.connections.pgsql.port') !== 55441) {
|
||||
@@ -164,6 +169,10 @@ final class LegacyContent
|
||||
$payload = $desk->decode($case->payload);
|
||||
foreach ($payload['investor_path']['content_sources'] ?? [] as $existing) {
|
||||
if ($existing['resource_id'] === $article['id'] && $existing['sha256'] === $article['sha256']) {
|
||||
if ($article['sector']) {
|
||||
app(SectorInvestment::class)->attach($actor, $caseId, ['version' => $data['version'], 'sector_slug' => $article['sector']['slug']]);
|
||||
}
|
||||
|
||||
return; // Same source/version replay: neither another reference nor another event.
|
||||
}
|
||||
}
|
||||
@@ -174,6 +183,9 @@ final class LegacyContent
|
||||
'saved_at' => now()->toIso8601String()];
|
||||
DB::table('desk_cases')->where('id', $caseId)->update(['payload' => $desk->encode($payload), 'version' => $case->version + 1, 'updated_at' => now()]);
|
||||
$desk->event($desk->case($actor, $caseId), $actor, 'legacy_content_referenced', ['resource_id' => $article['id'], 'sha256' => $article['sha256']]);
|
||||
if ($article['sector']) {
|
||||
app(SectorInvestment::class)->attach($actor, $caseId, ['version' => $case->version + 1, 'sector_slug' => $article['sector']['slug']]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user