fix: content sharing external badge#4589
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughPass a full ChangesContent sharing: currentUser + external gating update
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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-sharing/hooks/useSharingService.ts`:
- Around line 95-97: The invite-success path dereferences currentUser
(currentUser.id) without a null check; update the logic where the object with
currentUser, isCurrentUserOwner, and ownerEmailDomain is built (the block
referencing currentUser and ownerId) to guard currentUser first — compute
isCurrentUserOwner only if currentUser exists (e.g., currentUser &&
currentUser.id === ownerId or optional chaining), and only append to
collaborators or access any currentUser properties when currentUser is non-null;
ensure the invite callback in useSharingService.ts skips collaborator mutations
or uses a safe fallback when currentUser is null.
🪄 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: e8ad0dee-2450-428a-8490-5ed350e7a6e7
📒 Files selected for processing (8)
src/constants.jssrc/elements/content-sharing/ContentSharingV2.tsxsrc/elements/content-sharing/apis/__tests__/fetchCurrentUser.test.tssrc/elements/content-sharing/apis/fetchCurrentUser.tssrc/elements/content-sharing/hooks/__tests__/useSharingService.test.tssrc/elements/content-sharing/hooks/useSharingService.tssrc/elements/content-sharing/utils/__tests__/convertCollaborators.test.tssrc/elements/content-sharing/utils/convertCollaborators.ts
✅ Files skipped from review due to trivial changes (1)
- src/elements/content-sharing/apis/fetchCurrentUser.ts
03ac124 to
0f7a123
Compare
There was a problem hiding this comment.
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/constants.js`:
- Line 174: The file contains TypeScript-only syntax (e.g., declare var
__VERSION__: string and exports like FIELD_LOGIN: 'login' = 'login') inside a
.js file causing Biome parse errors; either convert the file to TypeScript by
renaming src/constants.js to src/constants.ts and update all imports/usages
accordingly, or remove all TypeScript type annotations and declare statements
(replace patterns like "declare var __VERSION__: string;" and "export const
FIELD_LOGIN: 'login' = 'login';" with plain JS equivalents such as simple
const/exports) so the file is valid JavaScript; locate symbols like FIELD_LOGIN
and the declare __VERSION__ to ensure all TS syntax is handled consistently
across the file.
🪄 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: ca0af714-ac4c-49fd-8ae5-988ab6e1428f
📒 Files selected for processing (8)
src/constants.jssrc/elements/content-sharing/ContentSharingV2.tsxsrc/elements/content-sharing/apis/__tests__/fetchCurrentUser.test.tssrc/elements/content-sharing/apis/fetchCurrentUser.tssrc/elements/content-sharing/hooks/__tests__/useSharingService.test.tssrc/elements/content-sharing/hooks/useSharingService.tssrc/elements/content-sharing/utils/__tests__/convertCollaborators.test.tssrc/elements/content-sharing/utils/convertCollaborators.ts
✅ Files skipped from review due to trivial changes (1)
- src/elements/content-sharing/hooks/tests/useSharingService.test.ts
There was a problem hiding this comment.
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-sharing/utils/__mocks__/ContentSharingV2Mocks.js`:
- Line 97: DEFAULT_USER_API_RESPONSE pairs the owner's id ('789') with the wrong
login (collabUser2.login); change the login property to mockOwner.login (or
mockOwnerEmail) so the entry with id '789' matches the owner's email; update the
mock object in ContentSharingV2Mocks.js (look for DEFAULT_USER_API_RESPONSE and
the login: collabUser2.login line) to use mockOwner.login to keep owner identity
consistent for domain-based collaborator gating 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: 1b002ddf-c1c3-4bab-8308-c3ad98e6680f
📒 Files selected for processing (1)
src/elements/content-sharing/utils/__mocks__/ContentSharingV2Mocks.js
701b131 to
c623626
Compare
Summary by CodeRabbit
Bug Fixes
Improvements
Tests