Skip to content

fix(activity-feed-v2): restore group results in task assignee search#4677

Merged
mergify[bot] merged 1 commit into
box:masterfrom
jackiejou:fix-task-assignee-group-search
Jul 7, 2026
Merged

fix(activity-feed-v2): restore group results in task assignee search#4677
mergify[bot] merged 1 commit into
box:masterfrom
jackiejou:fix-task-assignee-group-search

Conversation

@jackiejou

@jackiejou jackiejou commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Problem

Assigning a task from the file Activity Feed / Preview sidebar (Activity Feed V2) no longer returns group results, and the "only one assignee is required" completion-rule checkbox stays disabled even with multiple assignees selected.

The HAR shows the assignee search hitting:

GET /2.0/files/{fileId}/collaborators?filter_term=...&include_groups=false&respect_hidden_collabs=false&limit=25

include_groups=false is the mention-path default, not the approver path.

Root cause

TaskModalV2 wired its assignee search (fetchUsers) to the @mention path (getMentionAsync), which requests collaborators with includeGroups: false, respectHiddenCollabs: false. The V1 task flow used the approver path with includeGroups: true, respectHiddenCollabs: true, so groups were returned there.

Separately, the mention adapter dropped the type field when mapping API entries to user contacts. TaskFormV2 derives its completion-rule checkbox state from type === 'group' / type === 'user', so every assignee looked like type: undefined, leaving the checkbox permanently disabled.

Fix

  • Add a promise-based getApproverAsync to ActivitySidebar that requests collaborators with includeGroups: true, respectHiddenCollabs: true. It mirrors the existing getMentionAsync debounce + generation-guard pattern (so superseded searches resolve empty and stale responses are dropped), and is cleaned up on unmount.
  • Add a fetchApprovers callback in ActivityFeedV2 that wraps getApproverAsync and maps results through the existing mapCollaboratorToUserContact, which preserves each entry's type. Both TaskModalV2 instances now use it. The @mention path is unchanged, so groups stay excluded from comment mentions.
  • Remove the now-dead approverSelectorContacts / getApproverWithQuery props from ActivityFeedV2Props.

Testing

  • New unit tests for getApproverAsync (options passed, superseded-call resolves empty, error rejects) and for the V2 wiring (groups preserved with type, mention path not invoked, empty/missing/rejecting cases).
  • yarn test for both affected suites: 247 passing.
  • Lint clean on all changed files.

Summary by CodeRabbit

  • Bug Fixes

    • Improved collaborator search so pending lookups are cancelled cleanly when the sidebar closes or a newer search replaces an older one.
    • Task assignee/approver selection now uses a dedicated search flow, making results more reliable and preventing stuck loading states.
    • Empty, invalid, or failed searches now return no results instead of hanging.
  • New Features

    • Added support for separate approver search results in task creation and editing, while keeping mention search behavior unchanged.

Task assignee search in TaskModalV2 reused the mention path, which
requests collaborators with include_groups=false, so groups never
appeared and the dropped type field left the completion-rule checkbox
disabled. Add a promise-based getApproverAsync (include_groups=true,
respect_hidden_collabs=true) and map results through
mapCollaboratorToUserContact to preserve each entry type.
@jackiejou jackiejou requested review from a team as code owners July 7, 2026 17:49
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 6b5226dc-9acd-45f9-9200-8958e2d2193e

📥 Commits

Reviewing files that changed from the base of the PR and between 1e0e5f4 and 148c61f.

📒 Files selected for processing (5)
  • 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
  • src/elements/content-sidebar/activity-feed-v2/types.ts

Walkthrough

Replaces the synchronous debounced getApproverWithQuery approver lookup with a Promise-based getApproverAsync API in ActivitySidebar, mirroring existing mention-fetch behavior with generation-guarded pending resolves/rejects. ActivityFeedV2 adds a fetchApprovers callback wired into TaskModalV2, and related types and tests are updated.

Changes

Async approver collaborator lookup

Layer / File(s) Summary
Approver contract type change
src/elements/content-sidebar/activity-feed-v2/types.ts
Removes getApproverWithQuery and approverSelectorContacts; adds async getApproverAsync returning Promise<SelectorItem<UserMini | GroupMini>[]>, with new type imports.
Async approver fetching in ActivitySidebar
src/elements/content-sidebar/ActivitySidebar.js, src/elements/content-sidebar/__tests__/ActivitySidebar.test.js
Adds pendingApproverResolve/pendingApproverReject, approverGeneration, debouncedFetchApproverCollaborators, and getApproverAsync; updates componentWillUnmount to cancel/resolve pending mention and approver work; passes getApproverAsync to ActivityFeedV2; adds tests for resolution, superseded calls, and rejection.
ActivityFeedV2 fetchApprovers wiring into TaskModalV2
src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx, src/elements/content-sidebar/activity-feed-v2/__tests__/ActivityFeedV2.test.tsx
Destructures getApproverAsync, adds memoized fetchApprovers mapping results via mapCollaboratorToUserContact, swaps fetchUsers for fetchApprovers in edit/create TaskModalV2 renders, and adds tests covering trimmed query, empty/missing input, and rejection cases.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TaskModalV2
  participant ActivityFeedV2
  participant ActivitySidebar
  participant Collaborators API

  TaskModalV2->>ActivityFeedV2: fetchApprovers(query)
  ActivityFeedV2->>ActivitySidebar: getApproverAsync(query)
  ActivitySidebar->>ActivitySidebar: increment approverGeneration
  ActivitySidebar->>Collaborators API: debouncedFetchApproverCollaborators(query)
  Collaborators API-->>ActivitySidebar: collaborators.entries
  ActivitySidebar-->>ActivityFeedV2: resolve(entries) if generation matches
  ActivityFeedV2-->>TaskModalV2: mapped UserContactType[]
Loading

Possibly related PRs

Suggested labels: ready-to-merge

Suggested reviewers: jmcbgaston, mrscobbler

Poem

A rabbit hops with promise-quick feet,
No more callbacks, just async-sweet.
Generations guard each pending call,
Unmount cleans up, resolves them all.
Approvers fetched, tasks assigned with care —
🐇✨ hop on, the search flows fair!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: restoring group results in Activity Feed V2 task assignee search.
Description check ✅ Passed The description is complete and well structured with problem, root cause, fix, and testing details matching the change.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Biome (2.5.1)
src/elements/content-sidebar/ActivitySidebar.js

File contains syntax errors that prevent linting: Line 15: 'import { type x ident }' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 50: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 58: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 73: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 74: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 75: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 76: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 77: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 78: '

... [truncated 26553 characters] ...

ken. Did you mean {'>'} or &gt;?; Line 1449: expected } but instead found const; Line 1453: expected } but instead found return; Line 1454: Unexpected token. Did you mean {'}'} or &rbrace;?; Line 1456: Unexpected token. Did you mean {'}'} or &rbrace;?; Line 1459: expected } but instead found const; Line 1479: Expected an expression but instead found '}'.; Line 1486: expected } but instead found const; Line 1538: Unexpected token. Did you mean {'}'} or &rbrace;?; Line 1591: Unexpected token. Did you mean {'}'} or &rbrace;?; Line 1592: Unexpected token. Did you mean {'}'} or &rbrace;?; Line 1595: 'as' expression are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 1604: expected < but instead the file ends


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.

@mergify

mergify Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-07-07 20:10 UTC · Rule: Automatic strict merge · triggered by rule Automatic merge queue
  • Checks skipped · PR is already up-to-date
  • Merged2026-07-07 20:10 UTC · at 148c61f3ba0ae48ab585e8d8334a828416478dd4 · squash

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

Required conditions to merge
  • github-review-approved [🛡 GitHub branch protection]
  • github-review-decision = APPROVED [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Summary
    • check-neutral = Summary
    • check-skipped = Summary
  • any of [🛡 GitHub branch protection]:
    • check-success = lint_test_build
    • check-neutral = lint_test_build
    • check-skipped = lint_test_build
  • any of [🛡 GitHub branch protection]:
    • check-success = license/cla
    • check-neutral = license/cla
    • check-skipped = license/cla
  • any of [🛡 GitHub branch protection]:
    • check-success = lint_pull_request
    • check-neutral = lint_pull_request
    • check-skipped = lint_pull_request

@mergify mergify Bot merged commit 602f0c4 into box:master Jul 7, 2026
10 of 11 checks passed
@mergify mergify Bot removed the queued label Jul 7, 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