Skip to content

feat: Add menu to modify group permission - #3072

Open
zatteo wants to merge 2 commits into
masterfrom
feat/add-set-group-permission
Open

zatteo wants to merge 2 commits into
masterfrom
feat/add-set-group-permission

Conversation

@zatteo

@zatteo zatteo commented Jul 7, 2026

Copy link
Copy Markdown
Member
image

Summary by CodeRabbit

  • New Features
    • Group sharing permissions can now be changed directly, with immediate updates in the interface.
  • Bug Fixes
    • Permission changes now show an error message if the update fails.
    • Failed group permission updates are rolled back safely to keep sharing state consistent.
  • Refactor
    • Improved permission-change flow for both group and member recipients, with cleaner menu handling and fewer unnecessary updates.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

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: 6cb36b5a-87ca-4d3e-a70a-83471df0e117

📥 Commits

Reviewing files that changed from the base of the PR and between db82edd and 88b4a0f.

📒 Files selected for processing (5)
  • packages/cozy-sharing/src/SharingProvider.jsx
  • packages/cozy-sharing/src/SharingProvider.spec.jsx
  • packages/cozy-sharing/src/components/Recipient/GroupRecipientPermissions.jsx
  • packages/cozy-sharing/src/components/Recipient/MemberRecipientPermissions.jsx
  • packages/cozy-sharing/src/components/Recipient/actions/permission.js
💤 Files with no reviewable changes (1)
  • packages/cozy-sharing/src/components/Recipient/actions/permission.js

Walkthrough

This change adds an updateSharingGroupType method to SharingProvider, allowing group-level sharing permissions to be updated between read-only and read-write states with optimistic UI updates and rollback on failure. GroupRecipientPermissions is updated to use this new method along with an error alert, replacing its previous dependency on a removed permission action factory. MemberRecipientPermissions's setType handler is refactored to only trigger updates when the permission type actually changes. Corresponding tests are added for the new provider method.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a menu to modify group permissions in the share dialog.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-set-group-permission

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

t,
type
})
const setType = async newType => {

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.

I think if (newType === type) part can be optimized (we hideMenu anyway, the only condition is to trigger the try/catch or no).

Besides, it seems to me we have a part of the action here, and in the makeActions part 🤔 it's not very clear. Do you think we can optimize a bit to gather action logic in only one place?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored it a bit to be simplier. What do you mean by we have a part of the action here, and in the makeActions part 🤔 ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand. Currently setReadOnlySharedPermission and setReadWriteSharedPermission are generic and are used to set permissions for members, groups and links. They only carry the UI of the action as you said.

* @param {number} group - The index of the group in the sharing groups array
* @param {string} newType - 'one-way' for read-only, 'two-way' for read-write
*/
updateSharingGroupType = async (sharingId, groupIndex, newType) => {

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.

is it ok to disptach something... and then if it doesn't work, we dispatch a rollback? 🤔 sounds strange...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is usual optimistic update? I took the logic from the update member logic for the optimistic update here.

This branch has not been deployed

No deployments
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.

2 participants