Skip to content
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

Merged
merged 7 commits into from
Dec 5, 2023

Conversation

rohitvinnakota-codecov
Copy link
Contributor

@rohitvinnakota-codecov rohitvinnakota-codecov commented Dec 5, 2023

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.

  • Test and verify locally with umbrella-hat.

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.

@rohitvinnakota-codecov rohitvinnakota-codecov force-pushed the rvinnakota/username-selection branch from 3ae37e6 to 795c375 Compare December 5, 2023 15:43
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9f4c387) 95.55% compared to head (d7e7659) 95.55%.

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           
Flag Coverage Δ
unit ?
unit-latest-uploader ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-qa
Copy link

codecov-qa bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9f4c387) 95.64% compared to head (d7e7659) 95.64%.

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           
Flag Coverage Δ
unit 95.64% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 95.64% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rohitvinnakota-codecov rohitvinnakota-codecov marked this pull request as ready for review December 5, 2023 17:03
@@ -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:
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

@adrian-codecov adrian-codecov left a 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

@rohitvinnakota-codecov rohitvinnakota-codecov merged commit a29cd70 into main Dec 5, 2023
17 checks passed
@rohitvinnakota-codecov rohitvinnakota-codecov deleted the rvinnakota/username-selection branch December 5, 2023 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Username context/org doesn't include user in member count
2 participants