Skip to content

Conversation

@codeunia-dev
Copy link
Owner

@codeunia-dev codeunia-dev commented Nov 7, 2025

  • Add comprehensive reply history section to ticket detail page
  • Implement display of previous admin replies with user and timestamp
  • Modify API routes to fetch and return ticket replies with admin profiles
  • Add new database query to retrieve support ticket replies
  • Create visual design for reply history with admin avatar and metadata
  • Improve user experience by showing conversation context and reply tracking

Summary by CodeRabbit

New Features

  • Support ticket detail pages now display a reply history section showing all previous admin responses with respondent information, timestamps, and message content.
  • Admin replies to support tickets are now automatically persisted to the system for future reference and audit trails.

- Add comprehensive reply history section to ticket detail page
- Implement display of previous admin replies with user and timestamp
- Modify API routes to fetch and return ticket replies with admin profiles
- Add new database query to retrieve support ticket replies
- Create visual design for reply history with admin avatar and metadata
- Improve user experience by showing conversation context and reply tracking
@vercel
Copy link

vercel bot commented Nov 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
codeunia Building Building Preview Comment Nov 7, 2025 7:14am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 7, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The changes implement a ticket reply feature for the admin support system. The frontend displays historical ticket replies with admin metadata. The backend API now persists admin replies to the database and enriches ticket data with associated admin profiles during fetch operations.

Changes

Cohort / File(s) Change Summary
Frontend - Reply History UI
app/admin/support/[id]/page.tsx
Added TicketReply type with id, ticket_id, admin_id, message, timestamps, and optional admin object. Extended SupportTicket type with optional replies field. Renders new Reply History section displaying ticket replies with admin info, timestamp, and per-reply index badge.
Backend - Reply Persistence
app/api/admin/support/tickets/[id]/reply/route.ts
Inserts new admin reply into support_ticket_replies table after sending reply email. Logs errors on insert failure without aborting response. Returns reply object in API response payload.
Backend - Reply Data Enrichment
app/api/admin/support/tickets/[id]/route.ts
Extends GET handler to fetch all ticket replies ordered by created_at. Fetches admin profiles for distinct admin_ids in replies. Maps replies with enriched admin objects. Returns ticket response with new replies field containing enriched reply data.

Sequence Diagram

sequenceDiagram
    participant Admin
    participant FrontendUI as Frontend UI
    participant PostAPI as POST /reply
    participant GetAPI as GET /ticket
    participant DB as Database
    
    Admin->>FrontendUI: Fills reply form & submits
    FrontendUI->>PostAPI: POST reply with message
    PostAPI->>DB: Send reply email
    PostAPI->>DB: INSERT into support_ticket_replies
    DB-->>PostAPI: reply object
    PostAPI-->>FrontendUI: { success, reply }
    
    Admin->>FrontendUI: Loads ticket detail
    FrontendUI->>GetAPI: GET /tickets/[id]
    GetAPI->>DB: SELECT ticket, user, replies
    GetAPI->>DB: SELECT admin profiles for reply authors
    DB-->>GetAPI: enriched replies with admin data
    GetAPI-->>FrontendUI: ticket { ...user, replies[] }
    FrontendUI->>FrontendUI: Renders Reply History section
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Database schema assumptions: Review support_ticket_replies table structure and ensure column names/types match (ticket_id, admin_id, message, created_at)
  • Error handling strategy: Silent failure on reply insert could mask data persistence issues; verify logging is sufficient for debugging
  • Admin profile null handling: Confirm null admin objects are handled gracefully in frontend rendering
  • API response consistency: Verify reply enrichment logic matches expected data shape across both POST and GET endpoints
  • Data ordering and pagination: Check if reply history could grow unbounded; consider pagination if not handled elsewhere

Poem

🐰 A flurry of replies now stored,
Admin wisdom in the database poured,
Each ticket tells its history true,
With timestamps and admins peeking through!
Support threads dance in perfect rows—
The rabbit's ears twitch at the growth! 🌰✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/adminsupport

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4fdda6e and a43c788.

📒 Files selected for processing (3)
  • app/admin/support/[id]/page.tsx (3 hunks)
  • app/api/admin/support/tickets/[id]/reply/route.ts (1 hunks)
  • app/api/admin/support/tickets/[id]/route.ts (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeunia-dev codeunia-dev merged commit b1e31ea into main Nov 7, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants