feat: Hide "Leave sharing" for shared drives#3923
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughThe changes introduce a Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
BundleMonFiles updated (2)
Unchanged files (18)
Total files change +118B +0.01% Groups updated (1)
Unchanged groups (2)
Final result: ✅ View report in BundleMon website ➡️ |
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/modules/views/Sharings/helpers.js`:
- Around line 7-14: Update the `useSharingContext` hook declaration in
`src/declarations.d.ts` (lines 157-161) to include the `canLeave` property in
its return type. This property is currently being destructured and used in
`src/modules/views/Sharings/helpers.js` (at line 7) and propagated in the
returned object (at line 14), as well as being directly destructured in
`src/modules/drive/Toolbar/components/MoreMenu.jsx` (at line 49). Add `canLeave`
with the appropriate type to the `useSharingContext` declaration to align the
type contract with the actual usage pattern.
🪄 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: 446f0d38-d37a-44ad-ba6a-23c0269d946f
📒 Files selected for processing (3)
src/modules/drive/Toolbar/components/MoreMenu.jsxsrc/modules/shareddrives/components/actions/leaveSharedDrive.jssrc/modules/views/Sharings/helpers.js
| const { allLoaded, refresh, isOwner, canLeave } = sharingContext | ||
|
|
||
| return { | ||
| ...base, | ||
| ...nativeSharing, | ||
| refresh, | ||
| isOwner, | ||
| canLeave, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify contract drift between useSharingContext declaration and runtime usages
set -euo pipefail
echo "== Declaration for useSharingContext =="
fd -i "declarations.d.ts" --exec sed -n '140,190p' {}
echo
echo "== Usages of useSharingContext destructuring canLeave =="
rg -n -C2 "useSharingContext\\(\\)|canLeave" --type js --type jsx --type ts --type tsx
echo
echo "== Files that call canLeave(...) =="
rg -n -P "\\bcanLeave\\s*\\(" --type js --type jsx --type ts --type tsxRepository: linagora/twake-drive
Length of output: 1592
🏁 Script executed:
cat -n src/modules/views/Sharings/helpers.js | head -20Repository: linagora/twake-drive
Length of output: 670
🏁 Script executed:
rg -n "canLeave" --type ts --type jsRepository: linagora/twake-drive
Length of output: 816
🏁 Script executed:
cat -n src/declarations.d.ts | grep -A 20 "useSharingContext"Repository: linagora/twake-drive
Length of output: 797
Add canLeave to the useSharingContext declaration.
Line 7 of src/modules/views/Sharings/helpers.js destructures canLeave from sharingContext, and line 14 propagates it in the returned object. However, the useSharingContext declaration in src/declarations.d.ts:157-161 omits canLeave, creating a type contract drift. This also breaks typed usage in src/modules/drive/Toolbar/components/MoreMenu.jsx:49, which directly destructures canLeave from the hook.
🤖 Prompt for 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.
In `@src/modules/views/Sharings/helpers.js` around lines 7 - 14, Update the
`useSharingContext` hook declaration in `src/declarations.d.ts` (lines 157-161)
to include the `canLeave` property in its return type. This property is
currently being destructured and used in `src/modules/views/Sharings/helpers.js`
(at line 7) and propagated in the returned object (at line 14), as well as being
directly destructured in `src/modules/drive/Toolbar/components/MoreMenu.jsx` (at
line 49). Add `canLeave` with the appropriate type to the `useSharingContext`
declaration to align the type contract with the actual usage pattern.
For B2B shared drives, we want to hide "Leave sharing" as it is not wished.
80e830c to
65701bd
Compare
There was a problem hiding this comment.
Our agent can fix these. Install it.
Gates Passed
3 Quality Gates Passed
Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
For B2B shared drives, we want to hide "Leave sharing" as it is not wished.
Summary by CodeRabbit
cozy-sharingdependency to the latest patch version.