You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web): prompt sign-in overlay when unauthenticated viewer reacts with emoji (#2976) - #2977
When viewing a video on the share page (/s/<videoId>) as an unauthenticated or logged-out viewer, clicking any of the emoji reaction buttons (😂, 😍, 😮, 🙌, 👍, 👎) in the toolbar previously did nothing. The interaction was silently swallowed because handleEmojiClick checked if (!canReact || !user) return;.
In contrast, other viewer interactions on the toolbar (e.g. clicking Comment (c)) and sidebar (clicking the comment placeholder) consistently prompt the AuthOverlay modal ("Sign in to comment - Join the conversation.") so viewers can sign in and participate.
Root Cause
In apps/web/app/s/[videoId]/_components/Toolbar.tsx, handleEmojiClick checked:
if(!canReact||!user)return;
If user was falsy, execution returned early without triggering setShowAuthOverlay(true).
Extracted standard REACTIONS definitions and handleEmojiReaction guard logic into a focused helper.
Guard checks:
Returns early if !canReact.
Calls onRequireAuth() (setShowAuthOverlay(true)) when viewer is unauthenticated (!user).
Dispatches optimistic comment and backend submission when viewer is authenticated.
Updated Toolbar.tsx:
Uses handleEmojiReaction to trigger setShowAuthOverlay(true) upon unauthenticated emoji clicks, matching the behavior of the Comment (c) button.
Unit Tests (toolbar-reactions.test.ts):
Added 5 unit tests covering:
Exposing standard reaction set in display order.
Prompting sign-in overlay when user is null.
Prompting sign-in overlay when user is undefined.
Suppressing interaction when reactions are disabled (canReact = false).
Submitting reaction when viewer is signed in.
Tested and formatted with Biome (0 errors, 0 warnings).
Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.
Summary
Logged-out viewers now get the existing sign-in overlay when they click an emoji reaction.
Emoji clicks on shared video pages open the sign-in overlay for signed-out viewers.
Reviewed the full PR because the current and previously reviewed commits have different merge bases. No previous review threads were supplied. Checks were based on code; tests and browser behavior were not run.
Thanks @ghazy2001, good catch on #2976, opening the sign-in overlay for logged-out reactions matches how the comment button behaves. One small change before we merge: in Toolbar.tsx the onReact callback no longer knows user is set, so it now builds the optimistic comment with authorId: user?.id ?? "" and ?? null fallbacks that can never actually run (and would create an author-less comment if they did). Could you pass the narrowed user through, for example onReact: (emoji, user) => ... from handleEmojiReaction in toolbar-reactions.ts, and drop the fallbacks? Alternatively the whole fix can just be if (!canReact) return; if (!user) { setShowAuthOverlay(true); return; } at the top of the existing handleEmojiClick. Either is fine with us.
Thanks for the feedback! I've updated handleEmojiReaction to pass the narrowed, non-null user directly to onReact(emoji, user). In Toolbar.tsx, authedUser is now used directly to construct the optimistic comment and API payload without any ?? "" or ?? null fallbacks (authedUser.id, authedUser.name, authedUser.imageUrl). The unit tests have also been updated to verify the forwarded user parameter (5/5 passing).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2976
Summary
When viewing a video on the share page (
/s/<videoId>) as an unauthenticated or logged-out viewer, clicking any of the emoji reaction buttons (😂,😍,😮,🙌,👍,👎) in the toolbar previously did nothing. The interaction was silently swallowed becausehandleEmojiClickcheckedif (!canReact || !user) return;.In contrast, other viewer interactions on the toolbar (e.g. clicking
Comment (c)) and sidebar (clicking the comment placeholder) consistently prompt theAuthOverlaymodal ("Sign in to comment - Join the conversation.") so viewers can sign in and participate.Root Cause
In
apps/web/app/s/[videoId]/_components/Toolbar.tsx,handleEmojiClickchecked:If
userwas falsy, execution returned early without triggeringsetShowAuthOverlay(true).Solution
toolbar-reactions.ts):REACTIONSdefinitions andhandleEmojiReactionguard logic into a focused helper.!canReact.onRequireAuth()(setShowAuthOverlay(true)) when viewer is unauthenticated (!user).Toolbar.tsx:handleEmojiReactionto triggersetShowAuthOverlay(true)upon unauthenticated emoji clicks, matching the behavior of theComment (c)button.toolbar-reactions.test.ts):null.undefined.canReact = false).

Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Logged-out viewers now get the existing sign-in overlay when they click an emoji reaction.
Reviewed the full PR because the current and previously reviewed commits have different merge bases. No previous review threads were supplied. Checks were based on code; tests and browser behavior were not run.
Reviews (2) · Last reviewed commit: "Merge branch 'main' into fix/toolbar-rea..." · Reviewed by Greptile