fix(web): gate staff-only Convex queries to avoid RBAC errors on dashboard and tickets; docs: add desktop agent history and troubleshooting
This commit is contained in:
parent
7685370c05
commit
ab820ddeca
11 changed files with 144 additions and 33 deletions
|
|
@ -88,7 +88,7 @@ function formatDuration(durationMs: number) {
|
|||
}
|
||||
|
||||
export function TicketSummaryHeader({ ticket }: TicketHeaderProps) {
|
||||
const { convexUserId, role } = useAuth()
|
||||
const { convexUserId, role, isStaff } = useAuth()
|
||||
const isManager = role === "manager"
|
||||
useDefaultQueues(ticket.tenantId)
|
||||
const changeAssignee = useMutation(api.tickets.changeAssignee)
|
||||
|
|
@ -99,11 +99,12 @@ export function TicketSummaryHeader({ ticket }: TicketHeaderProps) {
|
|||
const pauseWork = useMutation(api.tickets.pauseWork)
|
||||
const updateCategories = useMutation(api.tickets.updateCategories)
|
||||
const agents = (useQuery(api.users.listAgents, { tenantId: ticket.tenantId }) as Doc<"users">[] | undefined) ?? []
|
||||
const queueArgs = convexUserId
|
||||
const queuesEnabled = Boolean(isStaff && convexUserId)
|
||||
const queueArgs = queuesEnabled
|
||||
? { tenantId: ticket.tenantId, viewerId: convexUserId as Id<"users"> }
|
||||
: "skip"
|
||||
const queues = (
|
||||
useQuery(convexUserId ? api.queues.summary : "skip", queueArgs) as TicketQueueSummary[] | undefined
|
||||
useQuery(queuesEnabled ? api.queues.summary : "skip", queueArgs) as TicketQueueSummary[] | undefined
|
||||
) ?? []
|
||||
const { categories, isLoading: categoriesLoading } = useTicketCategories(ticket.tenantId)
|
||||
const [status] = useState<TicketStatus>(ticket.status)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue