Skip to content

fix(activity-feed-v2): Map mention contacts via SelectorItem.item - #4783

Open
jackiejou wants to merge 1 commit into
box:masterfrom
jackiejou:fix/activity-feed-v2-mention-email
Open

fix(activity-feed-v2): Map mention contacts via SelectorItem.item#4783
jackiejou wants to merge 1 commit into
box:masterfrom
jackiejou:fix/activity-feed-v2-mention-email

Conversation

@jackiejou

@jackiejou jackiejou commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Activity Feed V2 mention search maps collaborator results with the shared mapCollaboratorToUserContact helper, so contact email is taken from SelectorItem.item.email the same way task approver search already does. getMentionAsync is typed as returning SelectorItem<UserMini | GroupMini>[], and local UserContact is aligned with @box/user-selector's UserContactType.

This restores email display in the mention typeahead for collaborators returned by FileCollaborators (which places email on the nested item, not on the SelectorItem wrapper).

Why

Mention fetchUsers previously read top-level email / login on each entry. SelectorItem results do not carry those fields at the top level, so every mention contact got an empty email even when item.email was populated.

Test plan

  • Unit: yarn test src/elements/content-sidebar/activity-feed-v2/__tests__/ActivityFeedV2.test.tsx
  • Manually open Activity Feed V2, type @ in a comment, and confirm collaborator rows show email subtitles
  • Confirm task assignee search still shows user emails and group entries as before

Summary by CodeRabbit

  • Bug Fixes
    • Improved mention-user lookup in the activity feed.
    • Added support for nested user data and missing email addresses.
    • Queries are now trimmed, while empty searches are skipped.
    • Improved handling when mention services are unavailable or return errors.
  • Tests
    • Expanded coverage for mention fetching, mapping, fallback values, and error scenarios.

Reuse mapCollaboratorToUserContact so mention emails come from
item.email, matching the approver path and FileCollaborators shape.
@jackiejou
jackiejou requested review from a team as code owners August 13, 2026 18:31
@coderabbitai

coderabbitai Bot commented Aug 13, 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 Plus

Run ID: a6804160-7a8f-4248-83d5-261492f0854f

📥 Commits

Reviewing files that changed from the base of the PR and between e957503 and e1c7612.

📒 Files selected for processing (3)
  • 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

ActivityFeedV2 now uses typed mention selector results and the shared mapCollaboratorToUserContact helper. Tests cover query handling, API failures, nested user data, and contact-field mapping.

Changes

ActivityFeedV2 mention integration

Layer / File(s) Summary
Typed mention contracts
src/elements/content-sidebar/activity-feed-v2/types.ts
UserContact now aliases UserContactType. getMentionAsync returns typed user-or-group selector items.
Mention fetching and validation
src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx, src/elements/content-sidebar/activity-feed-v2/__tests__/ActivityFeedV2.test.tsx
Mention results use mapCollaboratorToUserContact. Tests cover empty queries, missing or rejecting APIs, nested user data, numeric IDs, user types, string values, and empty email fallbacks.

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

Mergeability Score: ⚪ Minimal · up to e1c76

This change restores email display for mention contacts without evidence of a current correctness, security, availability, or deployment risk; no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

Suggested labels: javascript

Suggested reviewers: ahorowitz123, zhirongwang, tjuanitas

Poem

I hop through typed contacts, neat and bright,
Mapping each mention just right.
Nested users join the flow,
Empty emails softly glow,
Tests guard every query tonight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the fix for mapping Activity Feed V2 mention contacts through SelectorItem.item.
Description check ✅ Passed The description includes a summary, rationale, and test plan that explain the change and its expected behavior.
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

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.

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