Skip to content

Chore/videocall - #173

Merged
LuisAll12 merged 7 commits into
devfrom
chore/videocall
Apr 30, 2026
Merged

LuisAll12 merged 7 commits into
devfrom
chore/videocall

Conversation

@LuisAll12

@LuisAll12 LuisAll12 commented Apr 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

Release Notes

  • New Features
    • Added like functionality during video calls with dynamic button states based on your interaction status
    • Real-time notifications display when you receive a like or achieve a mutual match
    • "Like back" option available directly from notifications for quick interactions
    • Improved experience when advancing to the next potential match

@LuisAll12 LuisAll12 self-assigned this Apr 30, 2026
@coderabbitai

coderabbitai Bot commented Apr 30, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@LuisAll12 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 33 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fd0eff6b-a461-4353-af04-75cd00e07e8c

📥 Commits

Reviewing files that changed from the base of the PR and between 78a2b5a and 2b39e9a.

📒 Files selected for processing (2)
  • app/(protected)/videocall/(pages)/CallScreen.tsx
  • app/(protected)/videocall/index.tsx
📝 Walkthrough

Walkthrough

Adds like/match interaction functionality to video calls: the like button UI adapts based on like state, an animated banner notifies users of matches, and socket event handlers manage like interactions with automatic state expiration. Enhances video call teardown to decline matchmaking and fully reset session state before re-entering.

Changes

Cohort / File(s) Summary
Like UI and Notifications
app/(protected)/videocall/(pages)/CallScreen.tsx
Implements dynamic like button variant switching based on isLiked, receivedLike, and mutualLike states; adds animated like notification banner that displays "It's a match" or "You got liked!" with a "Like back" action trigger; extends ControlButton with "liked" variant styling.
Like State Management and Socket Integration
app/(protected)/videocall/index.tsx
Introduces like/match state (receivedLike, mutualLike, isLiked), schedules automatic expiration of like states, adds socket event handlers (receive_like, mutual_like, peer_left), implements handleLikeBack emitter, and refactors matchmaking teardown flow to decline room and reset all session state before re-entering matchmaking.

Sequence Diagram(s)

sequenceDiagram
    participant User as User A
    participant UI as UI Layer
    participant Socket as Socket/Signaling
    participant Peer as User B (Peer)
    
    User->>UI: Clicks Like Button
    UI->>Socket: Emit send_like
    Socket->>Peer: Deliver like notification
    Peer->>UI: Receives like state update
    UI->>UI: Display "You got liked!" banner
    Peer->>UI: Clicks "Like Back"
    Peer->>Socket: Emit send_like_back
    Socket->>User: Deliver like_back notification
    User->>UI: Receives mutualLike state
    UI->>UI: Animate banner to "It's a match"
    UI->>UI: Disable like button (mutual match)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Feature/connect videocall #112: Adds mediasoup socket-based room join/transport setup flow on same signaling layer that this PR extends with like-related socket event handlers.
  • Feature/layout videocall #115: Introduces videocall layout and ControlButton component that this PR builds upon by adding like state variants and notification banner UI.

Suggested labels

Feature

Suggested reviewers

  • GRuoss
  • Jamie-Poeffel

Poem

🐰✨ A rabbit's ode to matching hearts:

Two calls connect through socket's dance,
Like buttons spark a second glance,
A banner blooms—"Match made!"—hooray,
Hearts aligned in every way! 💕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Chore/videocall' is vague and generic, using a branch naming convention rather than describing the actual changes made to the codebase. Provide a descriptive title that summarizes the main change, such as 'Add like/match notification system to video calls' or 'Implement match interactions with like notifications and auto-expiration.'
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/videocall

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
Review rate limit: 0/1 reviews remaining, refill in 55 minutes and 33 seconds.

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

@LuisAll12 LuisAll12 added this to the Sprint3 milestone Apr 30, 2026
@Jamie-Poeffel
Jamie-Poeffel self-requested a review April 30, 2026 15:14

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/`(protected)/videocall/index.tsx:
- Around line 453-455: The handler handleNextUser (referenced via
handleNextUserRef.current and invoked on the "peer_left" event and from the Next
button) must be guarded against concurrent execution: add an in-flight or mutex
flag (e.g., isHandlingNextUser) at the same scope as the handleNextUser
function, have both call sites (the socket "peer_left" listener and the Next
button path) check and return immediately if the flag is true, set the flag true
at start of handleNextUser, and ensure the flag is cleared in a
finally/finalization path so it always resets on success or error; apply the
same guard to the other code paths mentioned in the 691-765 region to prevent
overlapping decline/leave/deactivate/activate sequences.
- Around line 686-689: The handleLikeBack handler currently emits
"send_like_back" unguarded; make it idempotent by checking and setting a local
flag/ref before emitting (similar to handleLike). Add a boolean ref or state
(e.g., hasLikedBackRef) checked at the top of handleLikeBack (if true, return),
then set it true immediately after the check and only then call
socketRef.current?.emit("send_like_back") (include roomIdRef in logs as now).
This prevents duplicate emits and local UI race conditions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e55b14b3-dce5-4fbd-8d1f-2969addc5c1b

📥 Commits

Reviewing files that changed from the base of the PR and between 77f0da6 and 78a2b5a.

📒 Files selected for processing (2)
  • app/(protected)/videocall/(pages)/CallScreen.tsx
  • app/(protected)/videocall/index.tsx

Comment on lines +453 to +455
socket.on("peer_left", () => {
handleNextUserRef.current();
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard handleNextUser against concurrent execution.

handleNextUser can be triggered automatically from Line 454 (peer_left) and manually via the Next button path, but there is no in-flight guard. Overlapping runs can duplicate decline/leave/deactivate/activate sequences and produce inconsistent call state.

Suggested fix
+const nextUserInFlightRef = useRef(false);

 async function handleNextUser() {
+    if (nextUserInFlightRef.current) return;
+    nextUserInFlightRef.current = true;
+    try {
         const roomId = roomIdRef.current;

         // Decline current match so these two users won't match again
         if (roomId) {
             try {
                 await api("/matchmaking/decline", {
                     method: "POST",
                     body: JSON.stringify({ roomId }),
                 });
             } catch {}
         }

         // Clean up video session without touching the matchmaking socket
         localStreamRef.current?.getTracks()?.forEach((t: any) => t.stop());
         localStreamRef.current = null;
         startingRef.current = false;
         ...
         try {
             await deactivateMatchmakingRef.current();
         } catch {}
         await activateMatchmaking();
+    } finally {
+        nextUserInFlightRef.current = false;
+    }
 }

Also applies to: 691-765

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/`(protected)/videocall/index.tsx around lines 453 - 455, The handler
handleNextUser (referenced via handleNextUserRef.current and invoked on the
"peer_left" event and from the Next button) must be guarded against concurrent
execution: add an in-flight or mutex flag (e.g., isHandlingNextUser) at the same
scope as the handleNextUser function, have both call sites (the socket
"peer_left" listener and the Next button path) check and return immediately if
the flag is true, set the flag true at start of handleNextUser, and ensure the
flag is cleared in a finally/finalization path so it always resets on success or
error; apply the same guard to the other code paths mentioned in the 691-765
region to prevent overlapping decline/leave/deactivate/activate sequences.

Comment on lines +686 to +689
function handleLikeBack() {
console.log("[LikeBack] User liked back in room:", roomIdRef.current);
socketRef.current?.emit("send_like_back");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Make handleLikeBack idempotent before emitting.

Unlike handleLike (Line 681), this path has no guard, so repeated taps can emit duplicate send_like_back events and race local UI state.

Suggested fix
 function handleLikeBack() {
-    console.log("[LikeBack] User liked back in room:", roomIdRef.current);
-    socketRef.current?.emit("send_like_back");
+    if (isLiked || mutualLike) return;
+    setIsLiked(true);
+    setReceivedLike(false);
+    socketRef.current?.emit("send_like_back");
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function handleLikeBack() {
console.log("[LikeBack] User liked back in room:", roomIdRef.current);
socketRef.current?.emit("send_like_back");
}
function handleLikeBack() {
if (isLiked || mutualLike) return;
setIsLiked(true);
setReceivedLike(false);
socketRef.current?.emit("send_like_back");
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/`(protected)/videocall/index.tsx around lines 686 - 689, The
handleLikeBack handler currently emits "send_like_back" unguarded; make it
idempotent by checking and setting a local flag/ref before emitting (similar to
handleLike). Add a boolean ref or state (e.g., hasLikedBackRef) checked at the
top of handleLikeBack (if true, return), then set it true immediately after the
check and only then call socketRef.current?.emit("send_like_back") (include
roomIdRef in logs as now). This prevents duplicate emits and local UI race
conditions.

@LuisAll12
LuisAll12 merged commit 0dc8a98 into dev Apr 30, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Elysio Project Apr 30, 2026
@LuisAll12

Copy link
Copy Markdown
Collaborator Author

closed #44
closed #43
closed #37
closed #35

@coderabbitai coderabbitai Bot mentioned this pull request May 1, 2026
@LuisAll12
LuisAll12 deleted the chore/videocall branch May 4, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants