Allow managers to comment without assignee; keep assignee requirement for admin/agent; reflect in UI

This commit is contained in:
Esdras Renan 2025-10-19 02:45:53 -03:00
parent b468c6c9e7
commit 7c025a0398
2 changed files with 7 additions and 4 deletions

View file

@ -38,7 +38,9 @@ export function TicketComments({ ticket }: TicketCommentsProps) {
const canSeeInternalComments = normalizedRole === "admin" || normalizedRole === "agent"
const hasAssignee = Boolean(ticket.assignee)
const isRequester = convexUserId ? ticket.requester.id === convexUserId : false
const canStaffComment = hasAssignee
// Gestor pode comentar sem responsável; admin/agent só com responsável
const isManager = normalizedRole === "manager"
const canStaffComment = hasAssignee || isManager
const canComment = isRequester || (isStaff && canStaffComment)
const addComment = useMutation(api.tickets.addComment)
const removeAttachment = useMutation(api.tickets.removeCommentAttachment)
@ -366,7 +368,7 @@ export function TicketComments({ ticket }: TicketCommentsProps) {
)}
{!canComment && (
<div className="rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-700">
Atribua um responsável ao chamado para que a equipe possa comentar.
Atribua um responsável ao chamado para que a equipe técnica possa comentar.
</div>
)}
<form onSubmit={handleSubmit} className="mt-4 space-y-3">