Update desktop icon assets and allow attachment-only comments

This commit is contained in:
Esdras Renan 2025-10-19 01:08:52 -03:00
parent 1251468b77
commit f606ac1570
9 changed files with 288 additions and 2 deletions

View file

@ -243,11 +243,17 @@ export function PortalTicketDetail({ ticketId }: PortalTicketDetailProps) {
toast.error("Esta máquina está desativada. Reative-a para enviar novas mensagens.")
return
}
if (!convexUserId || !comment.trim() || !ticket) return
if (!convexUserId || !ticket) return
const trimmed = comment.trim()
const hasText = trimmed.length > 0
if (!hasText && attachments.length === 0) {
toast.error("Adicione uma mensagem ou anexe ao menos um arquivo antes de enviar.")
return
}
const toastId = "portal-add-comment"
toast.loading("Enviando comentário...", { id: toastId })
try {
const htmlBody = sanitizeEditorHtml(toHtmlFromText(comment.trim()))
const htmlBody = hasText ? sanitizeEditorHtml(toHtmlFromText(trimmed)) : "<p></p>"
await addComment({
ticketId: ticket.id as Id<"tickets">,
authorId: convexUserId as Id<"users">,