Skip to content

Comments

🐛 Fixed reply form showing parent comment author's details#13

Open
tomerqodo wants to merge 2 commits intocoderabbit_combined_20260121_qodo_grep_cursor_copilot_base__fixed_reply_form_showing_parent_comment_authors_details_pr220from
coderabbit_combined_20260121_qodo_grep_cursor_copilot_head__fixed_reply_form_showing_parent_comment_authors_details_pr220
Open

🐛 Fixed reply form showing parent comment author's details#13
tomerqodo wants to merge 2 commits intocoderabbit_combined_20260121_qodo_grep_cursor_copilot_base__fixed_reply_form_showing_parent_comment_authors_details_pr220from
coderabbit_combined_20260121_qodo_grep_cursor_copilot_head__fixed_reply_form_showing_parent_comment_authors_details_pr220

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 21, 2026

Benchmark PR from qodo-benchmark#220

Summary by CodeRabbit

Bug Fixes

  • Fixed reply forms displaying incorrect member information. Reply forms were incorrectly showing the parent comment author's name and expertise instead of the logged-in user's details. They now correctly display the logged-in user's own information.

✏️ Tip: You can customize this high-level summary in your review settings.

rob-ghost and others added 2 commits January 21, 2026 15:48
ref https://linear.app/ghost/issue/BER-3212

When a user opened a reply form, the form header was showing the parent
comment author's name and expertise instead of the current user's data.
This happened because the code used a fallback pattern that pulled from
the comment being replied to when the current member had no value set.
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Walkthrough

The changes refactor FormWrapper to remove the comment property dependency and derive member data solely from the member object, eliminating fallback logic that previously pulled data from comment?.member. Additional e2e tests validate that reply forms use logged-in user information rather than inheriting from parent comment authors.

Changes

Cohort / File(s) Summary
Form Component Refactoring
apps/comments-ui/src/components/content/forms/form.tsx, apps/comments-ui/src/components/content/forms/reply-form.tsx
Removed comment?: Comment property from FormWrapperProps interface. Updated FormWrapper to derive memberName and memberExpertise solely from member object instead of fallback chains. Changed in_reply_to_id payload source from openForm.in_reply_to_id to parent.id. Updated dependency arrays and removed openForm from useCallback dependencies. Removed comment prop from FormWrapper invocation.
E2E Test Coverage
apps/comments-ui/test/e2e/actions.test.ts
Added two new end-to-end tests: "Reply form does not inherit expertise from parent comment author" and "Reply form does not inherit name from parent comment author". Tests validate that reply forms display logged-in user's member information rather than parent commenter data.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 No fallback hops for this clever form,
Member data stands alone, the new norm!
Expertise and names from the user's own store,
Parent whispers fade—just logged-in lore! 🍃

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
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.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main fix: removing the fallback pattern that caused reply forms to display parent comment author details instead of current member details.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@apps/comments-ui/src/components/content/forms/form.tsx`:
- Around line 264-265: The editability check currently gates editor.setEditable
on member?.expertise which will prevent users without expertise from typing;
verify whether editability should depend on member.name (as the comment implied)
or on expertise; then update the condition and dependency array in the effect
accordingly (e.g., use !!member?.name && progress !== 'sending' if name is
required, or remove the expertise check entirely if expertise is optional) and
update the nearby comment to reflect the chosen gating rule; ensure you
reference editor.setEditable, member, and progress when making the change.
- Around line 311-314: The code reads openForm.in_reply_to_snippet when
computing openStyles even though openForm is optional in FormWrapperProps and
MainForm can set isOpen without openForm; guard that access by checking openForm
exists (e.g., use optional chaining or an explicit null check) before reading
in_reply_to_snippet in the block that sets openStyles (the isOpen branch), so
replace the direct access with a safe check (references: openForm,
in_reply_to_snippet, isOpen, openStyles, FormWrapperProps, MainForm).
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 026e14c and 5d51df3.

📒 Files selected for processing (3)
  • apps/comments-ui/src/components/content/forms/form.tsx
  • apps/comments-ui/src/components/content/forms/reply-form.tsx
  • apps/comments-ui/test/e2e/actions.test.ts
🧰 Additional context used
🧬 Code graph analysis (2)
apps/comments-ui/src/components/content/forms/reply-form.tsx (1)
apps/comments-ui/src/utils/helpers.ts (1)
  • isMobile (140-142)
apps/comments-ui/test/e2e/actions.test.ts (1)
apps/comments-ui/test/utils/e2e.ts (1)
  • waitEditorFocused (9-13)
🔇 Additional comments (5)
apps/comments-ui/src/components/content/forms/form.tsx (2)

244-244: Member name now sourced solely from member — good alignment with the fix.


308-310: Member name/expertise now derive only from current member — consistent with the fix.

apps/comments-ui/src/components/content/forms/reply-form.tsx (2)

24-35: in_reply_to_id now uses parent.id and deps updated — solid fix.


47-48: FormWrapper usage matches new prop API.

apps/comments-ui/test/e2e/actions.test.ts (1)

614-680: Great regression coverage for reply-form identity behavior.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +264 to +265
editor.setEditable(!!member?.expertise && progress !== 'sending');
}, [editor, member, progress]);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Verify editor editability gating on expertise (could block users without expertise).
This now disables editing for members who haven’t set expertise. If expertise is optional, users may be unable to type. Also the comment above mentions “name,” so either the logic or comment is out of sync. Please confirm the intended requirement.

🔧 Suggested adjustment (if editability should depend on name as before)
-        editor.setEditable(!!member?.expertise && progress !== 'sending');
+        editor.setEditable(!!member?.name && progress !== 'sending');
📝 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
editor.setEditable(!!member?.expertise && progress !== 'sending');
}, [editor, member, progress]);
editor.setEditable(!!member?.name && progress !== 'sending');
}, [editor, member, progress]);
🤖 Prompt for AI Agents
In `@apps/comments-ui/src/components/content/forms/form.tsx` around lines 264 -
265, The editability check currently gates editor.setEditable on
member?.expertise which will prevent users without expertise from typing; verify
whether editability should depend on member.name (as the comment implied) or on
expertise; then update the condition and dependency array in the effect
accordingly (e.g., use !!member?.name && progress !== 'sending' if name is
required, or remove the expertise check entirely if expertise is optional) and
update the nearby comment to reflect the chosen gating rule; ensure you
reference editor.setEditable, member, and progress when making the change.

Comment on lines 311 to 314
let openStyles = '';
if (isOpen) {
const isReplyToReply = !!openForm?.in_reply_to_snippet;
const isReplyToReply = !!openForm.in_reply_to_snippet;
openStyles = isReplyToReply ? 'pl-[1px] pt-[68px] sm:pl-[44px] sm:pt-[56px]' : 'pl-[1px] pt-[48px] sm:pl-[44px] sm:pt-[40px]';
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's read the file to understand the context around lines 311-314
wc -l apps/comments-ui/src/components/content/forms/form.tsx

Repository: qodo-benchmark/Ghost-combined-coderabbit

Length of output: 142


🏁 Script executed:

# Read the relevant section and surrounding context
sed -n '290,330p' apps/comments-ui/src/components/content/forms/form.tsx

Repository: qodo-benchmark/Ghost-combined-coderabbit

Length of output: 1204


🏁 Script executed:

# Find the component's prop definition to check if openForm is optional
rg -n "interface.*Props|type.*Props|openForm.*:" apps/comments-ui/src/components/content/forms/form.tsx -A 20 -B 2

Repository: qodo-benchmark/Ghost-combined-coderabbit

Length of output: 3881


🏁 Script executed:

# Find all FormWrapper usages to verify the issue
rg -n "FormWrapper" apps/comments-ui/src --type=tsx -B 2 -A 5

Repository: qodo-benchmark/Ghost-combined-coderabbit

Length of output: 111


🏁 Script executed:

# Also check if OpenCommentForm type definition shows required vs optional fields
rg -n "OpenCommentForm" apps/comments-ui/src --type=tsx -B 2 -A 10

Repository: qodo-benchmark/Ghost-combined-coderabbit

Length of output: 111


🏁 Script executed:

# Find all FormWrapper usages
rg -n "FormWrapper" apps/comments-ui/src -B 2 -A 5

Repository: qodo-benchmark/Ghost-combined-coderabbit

Length of output: 6049


🏁 Script executed:

# Find OpenCommentForm type definition
rg -n "OpenCommentForm" apps/comments-ui/src -B 2 -A 10

Repository: qodo-benchmark/Ghost-combined-coderabbit

Length of output: 17498


🏁 Script executed:

# Let's examine the main-form.tsx file more closely to understand the isOpen state
cat -n apps/comments-ui/src/components/content/forms/main-form.tsx

Repository: qodo-benchmark/Ghost-combined-coderabbit

Length of output: 4629


Guard optional openForm access to avoid runtime crashes.
openForm is optional in FormWrapperProps, but line 313 accesses openForm.in_reply_to_snippet without a null check. MainForm (line 98) passes isOpen={true} without providing openForm, which will crash at runtime when the code attempts to read the property.

Proposed fix
-        const isReplyToReply = !!openForm.in_reply_to_snippet;
+        const isReplyToReply = !!openForm?.in_reply_to_snippet;
📝 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
let openStyles = '';
if (isOpen) {
const isReplyToReply = !!openForm?.in_reply_to_snippet;
const isReplyToReply = !!openForm.in_reply_to_snippet;
openStyles = isReplyToReply ? 'pl-[1px] pt-[68px] sm:pl-[44px] sm:pt-[56px]' : 'pl-[1px] pt-[48px] sm:pl-[44px] sm:pt-[40px]';
let openStyles = '';
if (isOpen) {
const isReplyToReply = !!openForm?.in_reply_to_snippet;
openStyles = isReplyToReply ? 'pl-[1px] pt-[68px] sm:pl-[44px] sm:pt-[56px]' : 'pl-[1px] pt-[48px] sm:pl-[44px] sm:pt-[40px]';
🤖 Prompt for AI Agents
In `@apps/comments-ui/src/components/content/forms/form.tsx` around lines 311 -
314, The code reads openForm.in_reply_to_snippet when computing openStyles even
though openForm is optional in FormWrapperProps and MainForm can set isOpen
without openForm; guard that access by checking openForm exists (e.g., use
optional chaining or an explicit null check) before reading in_reply_to_snippet
in the block that sets openStyles (the isOpen branch), so replace the direct
access with a safe check (references: openForm, in_reply_to_snippet, isOpen,
openStyles, FormWrapperProps, MainForm).

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.

2 participants