Skip to content

feat(content-sidebar): route comment create/delete to threaded API when threadedRepliesV2 is on#4594

Open
jackiejou wants to merge 1 commit into
box:masterfrom
jackiejou:feat/activity-sidebar-v2-threaded-comments-routing
Open

feat(content-sidebar): route comment create/delete to threaded API when threadedRepliesV2 is on#4594
jackiejou wants to merge 1 commit into
box:masterfrom
jackiejou:feat/activity-sidebar-v2-threaded-comments-routing

Conversation

@jackiejou
Copy link
Copy Markdown
Contributor

@jackiejou jackiejou commented May 28, 2026

Summary

  • When activityFeed.threadedRepliesV2.enabled is on, route createComment and deleteComment to the threaded comment API endpoints (createThreadedComment / deleteThreadedComment) regardless of the legacy hasReplies prop.
  • Mirrors the existing gate on updateComment, so all three comment mutation methods now use the same hasReplies || isThreadedRepliesV2Enabled condition.
  • Annotations, replies, and the feed read path are intentionally untouched.

Test plan

  • Unit: yarn test --watchAll=false --testPathPattern="ActivitySidebar.test" (133 tests pass; 2 new cases cover V2-only routing)
  • Manual: with hasReplies=false and threadedRepliesV2.enabled=true, create a top-level comment and confirm the request hits the threaded comments endpoint
  • Manual: with the same flags, delete a comment and confirm the request hits the threaded comments delete endpoint
  • Regression: with threadedRepliesV2.enabled=false, confirm legacy hasReplies behavior is unchanged for both create and delete

Summary by CodeRabbit

  • New Features

    • Enhanced comment creation and deletion functionality to support the threaded replies feature flag, ensuring consistent behavior whether using standard or threaded reply modes.
  • Tests

    • Added comprehensive test coverage for comment operations with the threaded replies feature flag, verifying correct behavior in both enabled and disabled states and preventing regression.

Review Change Stack

@jackiejou jackiejou requested review from a team as code owners May 28, 2026 02:26
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0a49aaf7-53c7-466d-b279-29bd3bc7ec1f

📥 Commits

Reviewing files that changed from the base of the PR and between 998751a and dfd6c7e.

📒 Files selected for processing (2)
  • src/elements/content-sidebar/ActivitySidebar.js
  • src/elements/content-sidebar/__tests__/ActivitySidebar.test.js
✅ Files skipped from review due to trivial changes (1)
  • src/elements/content-sidebar/tests/ActivitySidebar.test.js

Walkthrough

ActivitySidebar now gates comment creation and deletion through threaded APIs when the threadedRepliesV2.enabled feature flag is active, treating it as equivalent to the existing hasReplies behavior. Tests verify the feature flag correctly routes both operations to their threaded counterparts even when thread replies are disabled.

Changes

Threaded Replies V2 Feature Gating

Layer / File(s) Summary
Feature flag routing in deleteComment and createComment
src/elements/content-sidebar/ActivitySidebar.js
deleteComment and createComment read features from props, compute isThreadedRepliesV2Enabled from activityFeed.threadedRepliesV2.enabled, and route to threaded API methods when `hasReplies
Feature flag tests for deleteComment and createComment
src/elements/content-sidebar/__tests__/ActivitySidebar.test.js
Tests assert deleteComment and createComment invoke threaded API methods (deleteThreadedComment/createThreadedComment) when the feature flag is enabled, even if hasReplies is false, and that non-threaded methods are not called.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • box/box-ui-elements#4460: Both PRs wire the activityFeed.threadedRepliesV2.enabled feature flag in ActivitySidebar—one routes create/delete comment calls to threaded methods, and the other gates the feed component rendering to ActivityFeedV2.

Suggested labels

ready-to-merge

Suggested reviewers

  • ahorowitz123
  • kduncanhsu
  • tjuanitas

Poem

🐰 Threaded whispers now take flight,
When v2's flag shines oh so bright,
Delete and create find their way,
Through branching paths, come what may!
The tests stand guard, both swift and true. 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: routing comment create/delete operations to the threaded API when threadedRepliesV2 is enabled, which aligns perfectly with the changeset.
Description check ✅ Passed The description provides a clear summary of changes, implementation details, mirrors existing patterns, and includes a comprehensive test plan with unit and manual testing steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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

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.

@jackiejou jackiejou force-pushed the feat/activity-sidebar-v2-threaded-comments-routing branch from 998751a to 70bc729 Compare May 28, 2026 02:28
…en threadedRepliesV2 is on

When activityFeed.threadedRepliesV2.enabled is on, createComment and
deleteComment now route to createThreadedComment / deleteThreadedComment
regardless of the legacy hasReplies prop, mirroring the existing gate on
updateComment.
@jackiejou jackiejou force-pushed the feat/activity-sidebar-v2-threaded-comments-routing branch from 70bc729 to dfd6c7e Compare May 28, 2026 02:30
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