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

WIP: Update FaucetRequest with FK to Profile #884

Merged
merged 17 commits into from
Apr 30, 2018
Merged

Conversation

mbeacom
Copy link
Contributor

@mbeacom mbeacom commented Apr 13, 2018

Description

The goal of this PR is to deprecate some of the old user handling in the Faucet related views and add a FK relation between FaucetRequest and Profile.

Checklist
  • linter status: 100% pass
  • changes don't break existing behavior
  • commit message follows commit guidelines
Affected core subsystem(s)

faucet, profile

@@ -90,12 +92,12 @@ def save_faucet(request):
}, status=400)
fr = FaucetRequest.objects.create(
fulfilled=False,
github_username=github_profile,
input_github_username=profile_handle,
github_username=request.user.username,
github_meta=checkeduser,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@owocki Do we need or want the GH payload here? We could eliminate the additional call to GH entirely if we don't need github_meta/checkeduser

Copy link
Contributor

Choose a reason for hiding this comment

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

i dont think we need it no

@mbeacom mbeacom changed the title Update FaucetRequest with FK to Profile WIP: Update FaucetRequest with FK to Profile Apr 13, 2018
@codecov
Copy link

codecov bot commented Apr 13, 2018

Codecov Report

Merging #884 into master will increase coverage by 0.08%.
The diff coverage is 34.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #884      +/-   ##
==========================================
+ Coverage   31.48%   31.56%   +0.08%     
==========================================
  Files         106      106              
  Lines        7214     7227      +13     
  Branches      939      939              
==========================================
+ Hits         2271     2281      +10     
- Misses       4833     4836       +3     
  Partials      110      110
Impacted Files Coverage Δ
app/retail/emails.py 22.87% <0%> (ø) ⬆️
app/github/utils.py 60% <14.28%> (-1.47%) ⬇️
app/faucet/views.py 29.72% <21.73%> (+4.08%) ⬆️
app/faucet/admin.py 74.07% <70%> (-2.4%) ⬇️
app/faucet/models.py 91.66% <75%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d4d515...731ed7c. Read the comment docs.

Copy link
Contributor

@owocki owocki left a comment

Choose a reason for hiding this comment

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

didnt test but LGTM -- pls just test with both logged in / out before merging

@@ -90,12 +92,12 @@ def save_faucet(request):
}, status=400)
fr = FaucetRequest.objects.create(
fulfilled=False,
github_username=github_profile,
input_github_username=profile_handle,
github_username=request.user.username,
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need to be wrapped around request.user.is_authenticated() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not in this case. We're validating that profile is present on L67 which relies on L65 that checks if request.user.is_authenticated, otherwise the user will receive a 401.

migrations.AddField(
model_name='faucetrequest',
name='profile',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='faucet_requests', to='dashboard.Profile'),

Choose a reason for hiding this comment

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

E501 line too long (149 > 120 characters)

@mbeacom mbeacom merged commit ea5518c into master Apr 30, 2018
@mbeacom mbeacom deleted the mark-faucet-fk-profile branch April 30, 2018 20:52
CuriousLearner added a commit to CuriousLearner/web that referenced this pull request May 1, 2018
…6-296

* 'master' of https://github.com/gitcoinco/web: (31 commits)
  fixes https://rollbar.com/gitcoin/gitcoin/items/908
  dashboard.js -- onboard search was expecing falsy value, not -1
  measure hourly rates of different repos
  Fix url collision
  Restrict onboarding view to staff temporarily
  sets default search project status to 'any' (gitcoinco#936)
  staggers cron start times (gitcoinco#1034)
  dont show email address if not auth
  fixes gitcoinco#1025
  obfuscate usernames
  review: added feedback
  review: added feedback
  onboard: refactored code
  dashboard: handle redirect from onboard
  ftux: birth
  WIP: Update FaucetRequest with FK to Profile (gitcoinco#884)
  fixes tests
  no more underscore methods for non-private methods
  Fix gitcoinco#1032 - Resolve trans rendering for faucet request copy
  allow user to skip waiting for tip tx to clear blockchain
  ...
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.

3 participants