-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
Add shortcut to tip user #5415
Add shortcut to tip user #5415
Changes from 6 commits
9e55973
0e40576
b17e3d0
2617bde
5bc023d
6557d18
d1f3cfd
170b560
c82443b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -367,10 +367,26 @@ def send_tip_2(request): | |
TemplateResponse: Render the submission form. | ||
|
||
""" | ||
|
||
username = request.GET.get('username', None) | ||
is_user_authenticated = request.user.is_authenticated | ||
from_username = request.user.username if is_user_authenticated else '' | ||
primary_from_email = request.user.email if is_user_authenticated else '' | ||
|
||
user = {} | ||
if username: | ||
profiles = Profile.objects.filter(handle__icontains=username) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should do an exact match here to prevent similar names matching: i.e. I try to tip user There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, i already changed it! 😃 |
||
|
||
if profiles.exists(): | ||
profile = profiles.first() | ||
user['id'] = profile.id | ||
user['text'] = profile.handle | ||
|
||
if profile.avatar_baseavatar_related.exists(): | ||
user['avatar_id'] = profile.avatar_baseavatar_related.first().pk | ||
user['avatar_url'] = profile.avatar_baseavatar_related.first().avatar_url | ||
user['preferred_payout_address'] = profile.preferred_payout_address | ||
|
||
params = { | ||
'issueURL': request.GET.get('source'), | ||
'class': 'send2', | ||
|
@@ -380,4 +396,8 @@ def send_tip_2(request): | |
'title': 'Send Tip | Gitcoin', | ||
'card_desc': 'Send a tip to any github user at the click of a button.', | ||
} | ||
|
||
if user: | ||
params['user_json'] = user | ||
|
||
return TemplateResponse(request, 'onepager/send2.html', params) |
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.
can
->can't
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.
done!