feat: implement template filtering for notifications based on channel type and enhance email rendering with HTML wrapper, ensuring chat messages are sent as plain text
This commit is contained in:
@@ -170,6 +170,20 @@ async function registrarNotificacoes(
|
||||
criadaEm: Date.now(),
|
||||
});
|
||||
|
||||
// Se o ticket estiver associado a uma conversa, registrar também uma mensagem de chat
|
||||
// Isso garante o "duplo canal": email + chat para notificações importantes.
|
||||
if (ticket.conversaId) {
|
||||
const conteudoChat = mensagem.length > 0 ? `${titulo}: ${mensagem}` : titulo;
|
||||
|
||||
await ctx.db.insert("mensagens", {
|
||||
conversaId: ticket.conversaId,
|
||||
remetenteId: usuarioEvento,
|
||||
tipo: "texto",
|
||||
conteudo: conteudoChat,
|
||||
enviadaEm: Date.now(),
|
||||
});
|
||||
}
|
||||
|
||||
// Notificar responsável (se houver)
|
||||
if (ticket.responsavelId && ticket.responsavelId !== ticket.solicitanteId) {
|
||||
const responsavel = await ctx.db.get(ticket.responsavelId);
|
||||
|
||||
Reference in New Issue
Block a user