Allow managers to comment without assignee; keep assignee requirement for admin/agent; reflect in UI
This commit is contained in:
parent
b468c6c9e7
commit
7c025a0398
2 changed files with 7 additions and 4 deletions
|
|
@ -781,9 +781,10 @@ export const addComment = mutation({
|
|||
// Regra: a equipe (ADMIN/AGENT/MANAGER) só pode comentar se o ticket tiver responsável.
|
||||
// O solicitante (colaborador) pode comentar sempre.
|
||||
const isRequester = String(ticketDoc.requesterId) === String(author._id)
|
||||
const isStaff = normalizedRole === "ADMIN" || normalizedRole === "AGENT" || normalizedRole === "MANAGER"
|
||||
const isAdminOrAgent = normalizedRole === "ADMIN" || normalizedRole === "AGENT"
|
||||
const hasAssignee = Boolean(ticketDoc.assigneeId)
|
||||
if (!isRequester && isStaff && !hasAssignee) {
|
||||
// Gestores podem comentar mesmo sem responsável; admin/agent só com responsável
|
||||
if (!isRequester && isAdminOrAgent && !hasAssignee) {
|
||||
throw new ConvexError("Somente é possível comentar quando o chamado possui um responsável.")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue