Skip to content

tim kiem va gui yeu cau ket ban - #8

Merged
Hieukobtcode merged 1 commit into
mainfrom
friend
Aug 9, 2026
Merged

Hieukobtcode merged 1 commit into
mainfrom
friend

Conversation

@Hieukobtcode

@Hieukobtcode Hieukobtcode commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added a friend-request workflow with username search, optional messages, validation, loading states, and success feedback.
    • Added username-based user search support.
    • Added clear error and not-found messaging in the friend modal.
  • Style

    • Added styling for successful friend-request confirmations.

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
chatify Error Error Aug 9, 2026 9:27am
chatify-j6hz Error Error Aug 9, 2026 9:27am

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 478aa423-4cd3-4301-988c-b43e1168494d

📥 Commits

Reviewing files that changed from the base of the PR and between 68c12d4 and a1e9128.

📒 Files selected for processing (10)
  • backend/src/controllers/userController.js
  • backend/src/routes/userRoute.js
  • frontend/src/components/AddFriendModal/SearchForm.tsx
  • frontend/src/components/AddFriendModal/SendFriendRequest.tsx
  • frontend/src/components/auth/ProtectedRoute.tsx
  • frontend/src/components/chat/modals/AddFriendModal.tsx
  • frontend/src/index.css
  • frontend/src/services/friendService.ts
  • frontend/src/stores/useFriendRequest.ts
  • frontend/src/types/store.ts

📝 Walkthrough

Walkthrough

The change adds a backend username-search endpoint and a frontend friend-request flow. The modal validates usernames, displays search results, submits optional messages, manages loading and errors, and shows success feedback.

Changes

Friend Request Flow

Layer / File(s) Summary
User search API
backend/src/controllers/userController.js, backend/src/routes/userRoute.js
The backend validates a username query, returns selected user fields, and exposes the GET /search route.
Friend request service and state
frontend/src/types/store.ts, frontend/src/services/friendService.ts, frontend/src/stores/useFriendRequest.ts
The frontend adds typed search and friend-request operations. The Zustand store manages loading, errors, and fallback results.
Friend modal flow
frontend/src/components/chat/modals/AddFriendModal.tsx, frontend/src/components/AddFriendModal/*, frontend/src/index.css, frontend/src/components/auth/ProtectedRoute.tsx
The modal adds username search, validation, request submission, reset behavior, success feedback, and loading-aware controls. Supporting styling and import cleanup are included.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant AddFriendModal
  participant useFriendStore
  participant friendService
  participant UserController
  User->>AddFriendModal: Enter username
  AddFriendModal->>useFriendStore: searchByUserName(username)
  useFriendStore->>friendService: GET /search
  friendService->>UserController: Send username query
  UserController-->>friendService: Return matching user
  friendService-->>useFriendStore: Return user payload
  useFriendStore-->>AddFriendModal: Set search result
  User->>AddFriendModal: Submit friend request
  AddFriendModal->>useFriendStore: addFriend(to, message)
  useFriendStore->>friendService: POST friend request
  friendService-->>useFriendStore: Return response message
  useFriendStore-->>AddFriendModal: Complete request
  AddFriendModal-->>User: Show success feedback
Loading
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch friend

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.

@Hieukobtcode
Hieukobtcode merged commit 20ce0f2 into main Aug 9, 2026
1 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.

1 participant