Skip to content

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

Merged
mergify[bot] merged 1 commit into
box:masterfrom
jackiejou:fix/activity-feed-v2-mention-email
Aug 14, 2026
Merged

fix(activity-feed-v2): Map mention contacts via SelectorItem.item#4783
mergify[bot] merged 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.
    • Mention suggestions now use consistent user information across the editor and activity feed.
  • Tests
    • Expanded coverage for mention fetching, mapping, fallback values, and error scenarios.

@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: 64747b42-ef9b-45df-ae32-87b530ad9df5

📥 Commits

Reviewing files that changed from the base of the PR and between 20dcf34 and 4a70574.

📒 Files selected for processing (2)
  • src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.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, src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx
UserContactType replaces the local contact type. 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, contact fields, and empty email fallbacks.

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

Mergeability Score: ⚪ Minimal · up to 4a705

This localized change restores mention contact email display by reading the collaborator email from the nested selector item; no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

Suggested labels: ready-to-merge, javascript

Suggested reviewers: ahorowitz123, zhirongwang

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 describes the main change: mapping Activity Feed V2 mention contacts through SelectorItem.item.
Description check ✅ Passed The description explains the change, motivation, and test plan, and it matches the pull request objectives.
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.

Comment thread src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx
Reuse mapCollaboratorToUserContact so mention emails come from
item.email, matching the approver path and FileCollaborators shape.
@jackiejou
jackiejou force-pushed the fix/activity-feed-v2-mention-email branch from 20dcf34 to 4a70574 Compare August 13, 2026 21:58

@JChan106 JChan106 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.

lgtm

@mergify

mergify Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-14 00:04 UTC · Rule: Automatic strict merge · triggered by rule Automatic merge queue
  • Checks skipped · PR is already up-to-date
  • Merged2026-08-14 00:04 UTC · at 4a70574829a55196cc35461e0ca90f82a1cfb048 · squash

This pull request spent 25 seconds in the queue, including 4 seconds running CI.

Required conditions to merge
  • github-review-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 c6ef2ce into box:master Aug 14, 2026
10 of 11 checks passed
@mergify mergify Bot removed the queued label Aug 14, 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.

4 participants