-
Notifications
You must be signed in to change notification settings - Fork 0
Add unread badge and border/background to ticket list #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds per-user "last seen" tracking for tickets: a new TicketLastSeen model, migration, factory, service methods, API endpoints to mark seen and fetch unread counts, frontend debounce and unread-badge UI, trait updates on Ticket, and corresponding tests and fixtures. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Browser
participant ChatComponent
participant ChatWidget
participant API as Server
participant DB
User->>Browser: Open chat widget
Browser->>ChatWidget: init + render
ChatWidget->>API: GET /padmission-tickets/api/tickets/unread-count
API->>DB: query unread tickets using ticket_last_seen
DB-->>API: unread count
API-->>ChatWidget: return count
ChatWidget->>Browser: display unread badge
ChatWidget->>ChatWidget: start polling (10s)
Note over Browser,ChatComponent: user scrolls / views messages
ChatComponent->>ChatComponent: IntersectionObserver detects activity
ChatComponent->>ChatComponent: schedule debouncedMarkSeen (2s)
ChatComponent->>API: POST /padmission-tickets/api/tickets/{id}/mark-seen
API->>API: validate, authorize, verify activity belongs to ticket
API->>DB: create or update ticket_last_seen (last_seen_activity_id)
DB-->>API: persist
API-->>ChatComponent: success
ChatComponent->>ChatComponent: clear debounce timer
User->>Browser: close widget
ChatComponent->>ChatComponent: flush pending debounce
ChatComponent->>API: final POST mark-seen
API->>DB: persist final last_seen_activity_id
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Poem
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Free 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
…mission/tickets into feat/add-unread-badge-to-chat-widget
Summary by CodeRabbit
New Features
Bug Fixes / Improvements
✏️ Tip: You can customize this high-level summary in your review settings.