feat: Add real-time ticket updates via WebSocket and staff permission control
WebSocket Updates: - Create useTicketWebSocket hook for real-time ticket list updates - Hook invalidates React Query cache when tickets are created/updated - Shows toast notifications for new tickets and comments - Auto-reconnect with exponential backoff Staff Permissions: - Add can_access_tickets() method to User model - Owners and managers always have ticket access - Staff members need explicit can_access_tickets permission - Update Sidebar to conditionally show Tickets menu based on permission - Add can_access_tickets to API user response Backend Updates: - Update ticket signals to broadcast updates to all relevant users - Check ticket access permission in views 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,12 +2,16 @@ import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Ticket as TicketIcon, AlertCircle, CheckCircle2, Clock, Circle, Loader2, XCircle, Plus } from 'lucide-react';
|
||||
import { useTickets } from '../../hooks/useTickets';
|
||||
import { useTicketWebSocket } from '../../hooks/useTicketWebSocket';
|
||||
import { Ticket, TicketStatus } from '../../types';
|
||||
import TicketModal from '../../components/TicketModal';
|
||||
import Portal from '../../components/Portal';
|
||||
|
||||
const PlatformSupport: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
// Enable real-time ticket updates via WebSocket
|
||||
useTicketWebSocket({ showToasts: true });
|
||||
const [selectedTicket, setSelectedTicket] = useState<Ticket | null>(null);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const [statusFilter, setStatusFilter] = useState<TicketStatus | 'ALL'>('ALL');
|
||||
|
||||
Reference in New Issue
Block a user