Share several of a client's projects at once and show sharing in the list - #466
Merged
Merged
Conversation
…list The share email now names the client and the sharing organization. From the clients and projects list an admin can share any of a client's projects with one address in one go; the recipient gets one email and answers all open invitations from that organization together. Each project in the list shows who it is shared with or that an invitation is pending. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Follow-up to #463. Sharing one project at a time is tedious when a client has several, the invitation email didn't say which client the project belongs to, and the owner couldn't see what was shared without opening each project.
What changes
Answering invitations together
Open invitations from one organization to one address are answered together: whichever link the recipient opens, the invitation page lists all of them, and Accept/Decline applies to all (
ProjectShare#open_invitations_alongside). This needed no schema change. It also covers invitations sent separately, and ones sent before this change. When accepting, projects the chosen organization already has are left alone and the rest are accepted.Compatibility
No migration. Existing invitation links and tokens work as before. The mailer now takes
project_shares:instead ofproject_share:, so a share email sitting in the Sidekiq queue during the deploy would fail. We accepted that risk since the window is only seconds.Authorization
Workspace::Clients::SharesControllerloads the client throughauthorized_scope, authorizesshare?onWorkspace::ClientPolicy(admins of the owning organization) and authorizes each new share withWorkspace::ProjectSharePolicy. Only projects of that client can be selected, so other organizations' projects are ignored.Test plan
bin/rails test: 408 runs, 0 failures (new integration tests cover sharing several projects, validation, cross-org attempts, accepting/declining together, skipping projects the organization already has, and the list badges; mailer tests cover the single and multi-project email)bin/rails test:system: 9 runs, 0 failures (newclient_sharing_test.rbwalks through the modal)bin/rubocop: no offenses🤖 Generated with Claude Code