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

ref: Handle current_user in base #203

Merged
merged 3 commits into from
Oct 23, 2023
Merged

ref: Handle current_user in base #203

merged 3 commits into from
Oct 23, 2023

Conversation

RulaKhaled
Copy link
Contributor

Purpose/Motivation

What is the feature? Why is this being done?
passing current_user to use instead of relying on owner

Links to relevant tickets

TBD

What does this PR do?

Include a brief description of the changes in this PR. Bullet points are your friend.

  • Handled current user in executor
  • Default to none user, so we don't go over 1000 tests :D
  • Refactor save terms interactor to handle user specific fields

Notes to Reviewer

Anything to note to the team? Any tips on how to review, or where to start?
..

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.

@codecov-staging
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!.

@codecov-qa
Copy link

codecov-qa bot commented Oct 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (84a31da) 95.61% compared to head (dfb1224) 95.61%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #203   +/-   ##
=======================================
  Coverage   95.61%   95.61%           
=======================================
  Files         600      600           
  Lines       15223    15224    +1     
=======================================
+ Hits        14556    14557    +1     
  Misses        667      667           
Flag Coverage Δ
unit 95.61% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 95.61% <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.

@codecov-public-qa
Copy link

codecov-public-qa bot commented Oct 20, 2023

Codecov Report

Merging #203 (dfb1224) into main (84a31da) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #203   +/-   ##
=======================================
  Coverage   95.61%   95.61%           
=======================================
  Files         600      600           
  Lines       15223    15224    +1     
=======================================
+ Hits        14556    14557    +1     
  Misses        667      667           
Flag Coverage Δ
unit 95.61% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 95.61% <100.00%> (+<0.01%) ⬆️

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

Files Coverage Δ
codecov/commands/base.py 100.00% <100.00%> (ø)
codecov/commands/executor.py 100.00% <100.00%> (ø)
...commands/owner/interactors/save_terms_agreement.py 100.00% <100.00%> (ø)

Impacted file tree graph

@codecov
Copy link

codecov bot commented Oct 20, 2023

Codecov Report

Merging #203 (dfb1224) into main (84a31da) will not change coverage.
The diff coverage is 100.00%.

@@          Coverage Diff          @@
##            main    #203   +/-   ##
=====================================
  Coverage   95.52   95.52           
=====================================
  Files        714     714           
  Lines      15629   15630    +1     
=====================================
+ Hits       14929   14930    +1     
  Misses       700     700           
Flag Coverage Δ
unit 95.61% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 95.61% <100.00%> (+<0.01%) ⬆️

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

Files Coverage Δ
codecov/commands/base.py 100.00% <100.00%> (ø)
codecov/commands/executor.py 100.00% <100.00%> (ø)
...commands/owner/interactors/save_terms_agreement.py 100.00% <100.00%> (ø)

if self.current_owner:
self.current_user = self.current_owner.user
if self.current_owner and not self.current_user.is_authenticated:
self.current_user = self.current_owner
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mixing types. I think this could remain as:

if self.current_owner:
    self.current_user = self.current_owner.user
  • self.current_user is either User or AnonymousUser
  • self.current_owner is either None or Owner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh sorry lost with the new changes

@RulaKhaled RulaKhaled merged commit 50de754 into main Oct 23, 2023
19 of 20 checks passed
@RulaKhaled RulaKhaled deleted the base-handle-user branch October 23, 2023 10:19
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.

None yet

2 participants