Enforce assignee-required commenting for staff; UI disables commenting until responsible is set; poll machine session for live deactivation; desktop deactivation screen update
This commit is contained in:
parent
2a8fb4330c
commit
b468c6c9e7
2 changed files with 21 additions and 2 deletions
|
|
@ -778,6 +778,15 @@ export const addComment = mutation({
|
|||
throw new ConvexError("Apenas administradores e agentes podem registrar comentários internos")
|
||||
}
|
||||
|
||||
// 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 hasAssignee = Boolean(ticketDoc.assigneeId)
|
||||
if (!isRequester && isStaff && !hasAssignee) {
|
||||
throw new ConvexError("Somente é possível comentar quando o chamado possui um responsável.")
|
||||
}
|
||||
|
||||
if (ticketDoc.requesterId === args.authorId) {
|
||||
// O próprio solicitante pode comentar seu ticket.
|
||||
// Comentários internos já são bloqueados acima para quem não é STAFF.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue