Ownership transfer - email previous owner when nominee accepted or declined - #1038
Merged
Merged
Conversation
Test coverage93.74% line coverage reported by SimpleCov. |
DNR500
marked this pull request as ready for review
September 28, 2026 16:18
raspberrypiherokubot
temporarily deployed
to
editor-api-p-ownership--0zud0b
September 28, 2026 16:18
Inactive
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Resolve missing-recipient handling and perform the ownership role transition, or correct the completion email’s claims.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Adds emails to the previous owner when an ownership transfer is completed or declined.
Changes:
- Adds mailer actions, templates, and previews.
- Enqueues notifications from ownership-transfer callbacks.
- Expands model and mailer specs.
Review findings:
- Mailer recipients can be nil when the previous owner lookup fails.
- Completing a transfer does not update ownership roles, despite the email claiming it does.
| File | Reviewed change | Findings |
|---|---|---|
spec/models/ownership_transfer_spec.rb |
Tests notification callbacks. | — |
spec/mailers/school_ownership_mailer_spec.rb |
Tests recipients and email content. | — |
spec/mailers/previews/school_ownership_mailer_preview.rb |
Adds mailer previews. | — |
app/views/school_ownership_mailer/decline_ownership_transfer_previous_owner.text.erb |
Adds decline notification content. | — |
app/views/school_ownership_mailer/complete_ownership_transfer_previous_owner.text.erb |
Adds completion notification content. | Claims roles changed when they are not updated. |
app/models/ownership_transfer.rb |
Enqueues previous-owner notifications. | Ownership roles are not transitioned before notification. |
app/mailers/school_ownership_mailer.rb |
Defines completion and decline emails. | Can enqueue mail with no recipient when lookup returns nil. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| previous_owner = users_by_id[ownership_transfer.requested_by_user_id] | ||
| @previous_owner_name = previous_owner&.name.presence || 'there' | ||
|
|
||
| mail(to: previous_owner&.email, |
|
|
||
| Ownership of the Code Classroom account for <%= @school.name %> has been successfully transferred to the new owner. | ||
|
|
||
| You are no longer the owner of this school. As part of the transfer, your role has automatically been changed to Teacher. You will still be able to create students, classes and projects within the account. |
DNR500
deleted the
ownership-transfer-email-owner-accepted-or-delined
branch
September 29, 2026 08:16
This branch was previously deployed
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.

Summary
Issue: #1792
Sends email that lets the previous owner know what happened to the ownership transfer they started.
What this does