Skip to content

fix(activity-feed-v2): forward hasActiveFilters and harden UAA parser#4606

Merged
mergify[bot] merged 2 commits into
box:masterfrom
jackiejou:feat/activity-feed-v2-enhanced-uaa-followup
Jun 4, 2026
Merged

fix(activity-feed-v2): forward hasActiveFilters and harden UAA parser#4606
mergify[bot] merged 2 commits into
box:masterfrom
jackiejou:feat/activity-feed-v2-enhanced-uaa-followup

Conversation

@jackiejou

@jackiejou jackiejou commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Forward hasActiveFilters to ActivityFeed.Header.FilterMenu,
    derived from showOnlyMentionsMe || showResolved, so the activity
    feed filter trigger renders its pressed state when a filter is
    applied.
  • Rename useEnhancedActivities to shouldUseEnhancedActivities for
    naming consistency with shouldUseUAA and the shouldShow* options
    in the same feedItems options bag.
  • Add a missing-source guard to the FILE_ACTIVITY_TYPE_TASK parser
    case so an entry whose source key is absent is dropped rather than
    producing a phantom feed item by spreading undefined. Matches the
    existing comment and annotation guards.
  • Add Feed.test.js to CODEOWNERS so it is co-owned alongside
    Feed.js.

Test plan

  • Unit tests pass: yarn test --watchAll=false --testPathPattern="(activity-feed-v2|api/__tests__/Feed|content-sidebar/__tests__/ActivitySidebar)"
  • Flow: yarn flow reports no errors
  • With threaded-replies v2 enabled, applying "Mentions me" or
    "Show resolved" renders the filter trigger in its pressed state
  • With threaded-replies v2 disabled, the filter trigger renders in
    the unpressed state regardless of filter selections
  • A malformed UAA response missing the task source key drops the
    entry instead of producing a blank row in the feed

Summary by CodeRabbit

  • Bug Fixes

    • Improved activity feed parsing to handle missing task data gracefully
  • New Features

    • Filter menu now displays a visual indicator when filters are actively applied (e.g., mentions or resolved items)

jackiejou added 2 commits June 3, 2026 17:28
- Rename useEnhancedActivities to shouldUseEnhancedActivities for
  naming consistency with shouldUseUAA and the shouldShow* options
  in the same feedItems options bag.
- Add a missing-source guard to the FILE_ACTIVITY_TYPE_TASK parser
  case so entries lacking the task source key are dropped rather
  than producing a phantom feed item via spreading undefined.
  Matches the existing comment and annotation guards.
- Add Feed.test.js to CODEOWNERS so it is co-owned alongside Feed.js.
Forward hasActiveFilters to ActivityFeed.Header.FilterMenu, derived
from showOnlyMentionsMe or showResolved, so the activity feed filter
trigger renders its pressed state when a filter is applied.

Capture the FilterMenu prop in the ActivityFeedV2 test mock and
exercise the truthy combinations of showOnlyMentionsMe and
showResolved.
@jackiejou jackiejou requested review from a team as code owners June 4, 2026 00:31
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR renames Feed API options from useEnhancedActivities to shouldUseEnhancedActivities with a new shouldUseUAA flag, adds null-checking for task activity parsing, updates all related call sites and tests, and introduces filter state tracking to ActivityFeedV2's FilterMenu.

Changes

Feed API Refactor & Filter Menu State

Layer / File(s) Summary
Feed API contract and task activity null-check
src/api/Feed.js, CODEOWNERS
Feed.feedItems options refactored to shouldUseEnhancedActivities and shouldUseUAA, activity type selection branches on the new flag name, and task activity parsing now checks source presence before cloning.
Feed API tests for option names and task parsing
src/api/__tests__/Feed.test.js
feedItems test updated to use shouldUseEnhancedActivities: true, and task parsing validation extended to include empty source entries.
ActivitySidebar Feed API call site updates
src/elements/content-sidebar/ActivitySidebar.js, src/elements/content-sidebar/__tests__/ActivitySidebar.test.js
ActivitySidebar feedItems calls and all test assertions updated to use shouldUseEnhancedActivities and shouldUseUAA option names across threaded-replies-v2 and feature matrix scenarios.
Filter menu active state tracking
src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx, src/elements/content-sidebar/activity-feed-v2/__tests__/ActivityFeedV2.test.tsx
ActivityFeedV2 passes hasActiveFilters to FilterMenu based on active mention/resolution filters, with test suite extended to mock and validate FilterMenu prop changes across filter combinations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • box/box-ui-elements#4604: The main PR's Feed.js option naming refactor and task activity parsing work directly builds on earlier enhanced-activity parsing from PR #4604.

Suggested labels

ready-to-merge

Suggested reviewers

  • jmcbgaston
  • zhirongwang
  • reneshen0328
  • kduncanhsu
  • tjuanitas

Poem

🐰 The feed API's names now glow so clear,
shouldUseEnhancedActivities appears!
Task sources checked, filters now know their state—
A tidy refactor, the team celebrates! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the two main changes: forwarding hasActiveFilters to FilterMenu and hardening the UAA task parser with a missing-source guard.
Description check ✅ Passed The PR description provides a clear summary of all four changes with detailed explanations, and includes a comprehensive test plan with both automated 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/api/Feed.js (1)

577-593: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep useEnhancedActivities as a deprecated alias for now.

feedItems() takes a plain options bag, so any caller still sending useEnhancedActivities will now silently fall back to legacy comment/annotation activity types. Because this is a public contract rename, that becomes a behavioral regression instead of a loud failure.

♻️ Suggested compatibility shim
         {
             shouldShowAnnotations = false,
             shouldShowAppActivity = false,
             shouldShowReplies = false,
             shouldShowTasks = true,
             shouldShowVersions = true,
-            shouldUseEnhancedActivities = false,
+            shouldUseEnhancedActivities: shouldUseEnhancedActivitiesOption,
+            useEnhancedActivities = false,
             shouldUseUAA = false,
         }: {
             shouldShowAnnotations?: boolean,
             shouldShowAppActivity?: boolean,
             shouldShowReplies?: boolean,
             shouldShowTasks?: boolean,
             shouldShowVersions?: boolean,
-            shouldUseEnhancedActivities?: boolean,
+            shouldUseEnhancedActivities?: boolean,
+            useEnhancedActivities?: boolean,
             shouldUseUAA?: boolean,
         } = {},
         logAPIParity?: Function,
     ): void {
+        const shouldUseEnhancedActivities = shouldUseEnhancedActivitiesOption ?? useEnhancedActivities;
         const { id, permissions = {} } = file;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/api/Feed.js` around lines 577 - 593, The options destructuring in
feedItems (in src/api/Feed.js) removed the deprecated alias
useEnhancedActivities causing callers to silently get legacy behavior; restore
compatibility by accepting useEnhancedActivities in the same parameter bag and
map it into shouldUseEnhancedActivities (e.g., in the feedItems function
parameter or immediately after destructuring, set shouldUseEnhancedActivities =
shouldUseEnhancedActivities || useEnhancedActivities or use nullish coalescing
so incoming useEnhancedActivities flips the new flag), keeping the original
shouldUseEnhancedActivities name as the canonical flag.
src/elements/content-sidebar/__tests__/ActivitySidebar.test.js (1)

865-872: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep the threaded-replies-v2 feedItems contract assertions specific.

These two cases now only pin shouldShowReplies and shouldUseEnhancedActivities, so a regression in the same branch could still pass if shouldUseUAA flips or another option silently drops. Please keep asserting the rest of the options bag here, or at least include the defaulted flags that must remain unchanged on the v2 path.

Suggested tightening
-                expect.objectContaining({ shouldShowReplies: true, shouldUseEnhancedActivities: true }),
+                expect.objectContaining({
+                    shouldShowReplies: true,
+                    shouldUseEnhancedActivities: true,
+                    shouldUseUAA: false,
+                }),

Also applies to: 892-899

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/elements/content-sidebar/__tests__/ActivitySidebar.test.js` around lines
865 - 872, The test's call assertion for feedAPI.feedItems (using
feedAPI.feedItems, instance.fetchFeedItemsSuccessCallback,
instance.fetchFeedItemsErrorCallback, instance.errorCallback) only pins
shouldShowReplies and shouldUseEnhancedActivities; tighten it to assert the full
options bag expected for threaded-replies-v2 (include shouldUseUAA plus other
defaulted flags that must not change) rather than a partial
expect.objectContaining, and apply the same tightening to the duplicate
assertion around the other occurrence (the block around lines ~892-899) so both
v2-path assertions verify the complete options object.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/api/Feed.js`:
- Around line 577-593: The options destructuring in feedItems (in
src/api/Feed.js) removed the deprecated alias useEnhancedActivities causing
callers to silently get legacy behavior; restore compatibility by accepting
useEnhancedActivities in the same parameter bag and map it into
shouldUseEnhancedActivities (e.g., in the feedItems function parameter or
immediately after destructuring, set shouldUseEnhancedActivities =
shouldUseEnhancedActivities || useEnhancedActivities or use nullish coalescing
so incoming useEnhancedActivities flips the new flag), keeping the original
shouldUseEnhancedActivities name as the canonical flag.

In `@src/elements/content-sidebar/__tests__/ActivitySidebar.test.js`:
- Around line 865-872: The test's call assertion for feedAPI.feedItems (using
feedAPI.feedItems, instance.fetchFeedItemsSuccessCallback,
instance.fetchFeedItemsErrorCallback, instance.errorCallback) only pins
shouldShowReplies and shouldUseEnhancedActivities; tighten it to assert the full
options bag expected for threaded-replies-v2 (include shouldUseUAA plus other
defaulted flags that must not change) rather than a partial
expect.objectContaining, and apply the same tightening to the duplicate
assertion around the other occurrence (the block around lines ~892-899) so both
v2-path assertions verify the complete options object.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7d2a31b9-a697-4d96-9a3f-b793c3f9f305

📥 Commits

Reviewing files that changed from the base of the PR and between 54e1b58 and 3089424.

📒 Files selected for processing (7)
  • CODEOWNERS
  • src/api/Feed.js
  • src/api/__tests__/Feed.test.js
  • src/elements/content-sidebar/ActivitySidebar.js
  • src/elements/content-sidebar/__tests__/ActivitySidebar.test.js
  • src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx
  • src/elements/content-sidebar/activity-feed-v2/__tests__/ActivityFeedV2.test.tsx

@mergify

mergify Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-06-04 16:33 UTC · Rule: Automatic strict merge
  • Checks skipped · PR is already up-to-date
  • Merged2026-06-04 16:33 UTC · at 3089424dbf48aa7414e58b3eab8adbff0807c35f · squash

This pull request spent 13 seconds in the queue, including 2 seconds running CI.

Required conditions to merge

@mergify mergify Bot merged commit 063062d into box:master Jun 4, 2026
10 of 11 checks passed
@mergify mergify Bot removed the queued label Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants