tests / ci (push) Canceled after 0s
Em produção, os pedidos de interesse feitos em /apoio nunca foram vistos: só o caminho da API enfileirava o aviso à equipa. O aviso passa para o InterestSubmission::receive, por onde passam todos os caminhos de entrada, e a submissão de um pedido no Balcão Virtual passa a avisar também a equipa (até aqui só o proponente e um analista já atribuído recebiam aviso interno). - TeamNotifications: fila transaccional comum (só existe aviso se o registo ficou gravado); destinatários de PORTAL_NOTIFICATION_RECIPIENTS, sem dados pessoais nas mensagens. - NotifyDeskRequestSubmitted: protocolo e ligações protegidas de triagem. - DemographicInstallation aceita também o domínio público como a mesma instalação de produção, para o APP_URL poder passar a investemoz.tempo.co.mz. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzJmxFy3izprXr5dSq91jm
33 lines
1.2 KiB
PHP
33 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use Closure;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Support\Facades\Queue;
|
|
|
|
/**
|
|
* Internal e-mail notices to the Tempo team (PORTAL_NOTIFICATION_RECIPIENTS).
|
|
* Queued inside the caller's transaction on the database queue, so a notice exists
|
|
* only if the business record was stored. Jobs carry identifiers, never personal data.
|
|
*/
|
|
final class TeamNotifications
|
|
{
|
|
/** @param Closure(string): ShouldQueue $jobFor */
|
|
public static function queue(Closure $jobFor): void
|
|
{
|
|
if (! config('portal.notifications_enabled')) {
|
|
return;
|
|
}
|
|
$connection = config('queue.connections.database.connection');
|
|
if (config('queue.connections.database.after_commit') || ($connection && $connection !== config('database.default'))) {
|
|
throw new \RuntimeException('Portal notifications require the transactional database queue.');
|
|
}
|
|
foreach (array_unique(config('portal.notification_recipients')) as $recipient) {
|
|
if (filter_var($recipient, FILTER_VALIDATE_EMAIL)) {
|
|
Queue::connection('database')->push($jobFor($recipient));
|
|
}
|
|
}
|
|
}
|
|
}
|