[PM-33501] Prevent orphaned Sends during user and org deletion#7386
[PM-33501] Prevent orphaned Sends during user and org deletion#7386
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7386 +/- ##
==========================================
+ Coverage 62.58% 62.64% +0.06%
==========================================
Files 2060 2064 +4
Lines 91184 91372 +188
Branches 8114 8144 +30
==========================================
+ Hits 57069 57244 +175
+ Misses 32144 32142 -2
- Partials 1971 1986 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
New Issues (123)Checkmarx found the following issues in this Pull Request
|
| [dbo].[OrganizationReport] | ||
| WHERE | ||
| [OrganizationId] = @Id | ||
| -- Delete Organization Owned Sends |
There was a problem hiding this comment.
⛏️ Differs in formatting, add blank line before comment
r-tome
left a comment
There was a problem hiding this comment.
AC changes look good! I just left a non-blocking suggestion
| } | ||
| } | ||
|
|
||
| var sends = await _sendRepository.GetManyByOrganizationIdAsync(organization.Id); |
There was a problem hiding this comment.
⛏️ : Moving this to a private method would make this easier to read
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR prevents orphaned Send files during user and organization deletion by ensuring blob storage files are deleted before their corresponding database records. The fix in Code Review DetailsNo findings requiring inline comments. The implementation is consistent across all three deletion paths (org delete, user delete, individual send delete), null handling is correct, and the SQL migration aligns with the EF changes. |
|






🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-33501
📔 Objective
This PR resolves the possibility of Sends becoming orphaned during user or organization deletion. It is worth noting that Sends aren't currently associated with organizations, but this functionality is planned, and code in this PR is intended to support the complete removal of Send data associated to a deleted organization.