Skip to content

feat(content-uploader): add support for item share button and open preview button#4627

Merged
mergify[bot] merged 5 commits into
box:masterfrom
Omfalos:uploadsContentNewCallbacks
Jun 16, 2026
Merged

feat(content-uploader): add support for item share button and open preview button#4627
mergify[bot] merged 5 commits into
box:masterfrom
Omfalos:uploadsContentNewCallbacks

Conversation

@Omfalos

@Omfalos Omfalos commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Add support to two new callbacks added to the uploads manager that where not passed from wrapping component
They enable to perform action connected to share and to opening in new tab

Summary by CodeRabbit

  • New Features
    • Enhanced the content uploader with two new optional callbacks to handle sharing and opening individual items.
  • Tests
    • Added coverage to ensure these callbacks are correctly forwarded through the modernized uploads flow, and remain unset when not provided.

@Omfalos
Omfalos requested review from a team as code owners June 15, 2026 11:50
@coderabbitai

coderabbitai Bot commented Jun 15, 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: f3fc6de1-dcbb-4f45-a1ce-c31cf04177a7

📥 Commits

Reviewing files that changed from the base of the PR and between 8bc4f76 and 13762c7.

📒 Files selected for processing (1)
  • src/elements/content-uploader/ContentUploader.tsx
💤 Files with no reviewable changes (1)
  • src/elements/content-uploader/ContentUploader.tsx

Walkthrough

Two optional callbacks, onItemShare and onItemOpen, are added to ContentUploaderProps, destructured in render(), and forwarded to UploadsManagerBP when enableModernizedUploads is enabled. Tests verify both prop passthrough and default behavior.

Changes

Item Share/Open Callback Wiring

Layer / File(s) Summary
Prop declaration and UploadsManagerBP wiring
src/elements/content-uploader/ContentUploader.tsx
Adds onItemShare and onItemOpen as optional (itemId: string) => void callbacks to ContentUploaderProps, destructures both in render(), and passes them to UploadsManagerBP.
Tests for callback passthrough and default behavior
src/elements/content-uploader/__tests__/ContentUploader.test.js
Adds test cases asserting UploadsManagerBP receives onItemShare and onItemOpen when provided, and that both are undefined when omitted.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Possibly related PRs

  • box/box-ui-elements#4571: Modifies the same UploadsManagerBP integration in ContentUploader, gating rendering via enableModernizedUploads.
  • box/box-ui-elements#4573: Also modifies ContentUploader.tsx to wire per-item callbacks from the component into UploadsManagerBP in the enableModernizedUploads path.

Suggested reviewers

  • olehrybak
  • dealwith
  • jpan-box
  • reneshen0328

Poem

🐰 Hop hop, two callbacks hop into place,
onItemShare and onItemOpen embrace! From props they flow to UploadsManagerBP`,
With tests that prove they work so free.
The rabbit cheers — what a clean prop tree! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding support for two new callbacks (item share and open preview) in the content uploader component.
Description check ✅ Passed The description provides a brief explanation of the changes but lacks structured detail about what was modified, why, and testing approach.
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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@src/elements/content-uploader/ContentUploader.tsx`:
- Around line 177-178: The defaultProps in ContentUploader.tsx are setting
onItemShare and onItemOpen to noop, which causes action buttons to appear even
when callers don't provide these handlers. In
src/elements/content-uploader/ContentUploader.tsx at lines 177-178, remove the
`onItemShare: noop` and `onItemOpen: noop` entries from defaultProps so these
properties remain undefined when omitted by callers, allowing the buttons to be
hidden as intended. Then in
src/elements/content-uploader/__tests__/ContentUploader.test.js at lines
1316-1324, update the existing tests that verify default noop behavior by
replacing them with assertions that either verify the callbacks remain undefined
when not provided, or that the corresponding action buttons are not rendered in
integration-level tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1375a2ab-a925-4cd9-abe6-93819fd4ca9c

📥 Commits

Reviewing files that changed from the base of the PR and between 7f63ba1 and 4c6136c.

📒 Files selected for processing (2)
  • src/elements/content-uploader/ContentUploader.tsx
  • src/elements/content-uploader/__tests__/ContentUploader.test.js

Comment thread src/elements/content-uploader/ContentUploader.tsx Outdated
dlasecki-box
dlasecki-box previously approved these changes Jun 15, 2026
olehrybak
olehrybak previously approved these changes Jun 15, 2026

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

Looks good

Nefaris
Nefaris previously approved these changes Jun 15, 2026
@Omfalos
Omfalos dismissed stale reviews from Nefaris, olehrybak, and dlasecki-box via 8bc4f76 June 16, 2026 09:08
bkepka-box
bkepka-box previously approved these changes Jun 16, 2026
@mergify

mergify Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-06-16 14:49 UTC · Rule: Automatic strict merge
  • Checks passed · in-place
  • Merged2026-06-16 15:00 UTC · at 7d2d6baf8d9ca7daef5b1cdcaab5f9ae9cb84e72 · squash

This pull request spent 10 minutes 55 seconds in the queue, including 10 minutes 30 seconds running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 5a31ded into box:master Jun 16, 2026
9 of 10 checks passed
@mergify mergify Bot removed the queued label Jun 16, 2026
kduncanhsu pushed a commit to kduncanhsu/box-ui-elements that referenced this pull request Jun 18, 2026
…eview button (box#4627)

* feat(content-uploader): add support for item share button and open preview button

* feat(content-uploader): add support for item share button and open preview button

* feat(content-uploader): fix test to check default param of undefined

* feat(content-uploader): remove undefined value as it is by default undefined already

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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.

8 participants