-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto activate owner when default org is updated or created #293
Conversation
3ae37e6
to
795c375
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #293 +/- ##
=====================================
Coverage 95.55 95.55
=====================================
Files 724 724
Lines 16117 16121 +4
=====================================
+ Hits 15400 15404 +4
Misses 717 717
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #293 +/- ##
=======================================
Coverage 95.64% 95.64%
=======================================
Files 610 610
Lines 15710 15714 +4
=======================================
+ Hits 15026 15030 +4
Misses 684 684
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -30,7 +31,10 @@ def update_default_organization(self, default_org: Optional[Owner]): | |||
owner_id=self.current_owner.ownerid | |||
) | |||
owner_profile.default_org = default_org | |||
return owner_profile.save() | |||
saved_owner_profile = owner_profile.save() | |||
if default_org: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to get rid of this line since it's accounted for above in the validate
function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not raising any exceptions in the validation function if the org is None
so it looks like we can still execute this flow with a null org.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you're right, that None return would only affect the validate, not this function, so your check makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, just that little comment I left
Purpose/Motivation
What is the feature? Why is this being done?
This PR fixes codecov/engineering-team#304. When a user chooses their default org, they are not automatically added unless they open a PR in that org. With this change, they user is auto assigned a seat when they update their default org.
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.