[PM-37595] Use New OrganizationUserStatusType Columns#7693
Open
sven-bitwarden wants to merge 2 commits into
Open
[PM-37595] Use New OrganizationUserStatusType Columns#7693sven-bitwarden wants to merge 2 commits into
sven-bitwarden wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7693 +/- ##
=======================================
Coverage 64.86% 64.86%
=======================================
Files 2140 2140
Lines 94629 94635 +6
Branches 8445 8446 +1
=======================================
+ Hits 61378 61383 +5
- Misses 31155 31156 +1
Partials 2096 2096 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
eliykat
reviewed
May 23, 2026
Member
eliykat
left a comment
There was a problem hiding this comment.
Really tidy and nicely done. Just one thought below.
| INNER JOIN | ||
| @OrganizationUserIds OUI ON OUI.[Id] = OU.[Id] | ||
| WHERE | ||
| OU.[Status] != -1 -- Skip already-revoked rows so existing StatusNew / RevocationReason are preserved |
Comment on lines
+121
to
+125
| // OrganizationUserStatusTypeNew has no Revoked variant, so any populated value is valid. | ||
| if (StatusNew.HasValue) | ||
| { | ||
| return (OrganizationUserStatusType)(short)StatusNew.Value; | ||
| } |
Member
There was a problem hiding this comment.
While your comment is true, and all things going well we should never end up with an invalid value, I am leaning towards being more defensive about it.
The cast does not validate that the enum is in a valid range: https://dotnetfiddle.net/KeF7Ke. So if we do end up with a bad value, it propagates through the system.
We could have an explicit conversion method instead:
public static class OrganizationUserStatusTypeNewExtensions
{
public static OrganizationUserStatusType ToOrganizationUserStatusType(this OrganizationUserStatusTypeNew status)
=> status switch
{
OrganizationUserStatusTypeNew.Invited => OrganizationUserStatusType.Invited,
OrganizationUserStatusTypeNew.Accepted => OrganizationUserStatusType.Accepted,
OrganizationUserStatusTypeNew.Confirmed => OrganizationUserStatusType.Confirmed,
_ => // TODO: how to handle this? Throw, or return null for the caller to handle?
};
} Open for discussion.
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.
🎟️ Tracking
PM-37595
📔 Objective
This PR implements phase 2 of separating revoked from
OrganizationUserStatusType.A prior PR added the column to support the work. This PR now begins lightly using the new column.
When a user is revoked, we will copy the status they were being revoked from into the column. In essence, this acts like a "prior status" placeholder.
If/when the user is subsequently restored, and the user has a value present for the new status type, we will restore them from the placeholder. If no value is present (they were revoked before we started tracking this dual-column system), we fallback to existing logic.