diff --git a/app/app/urls.py b/app/app/urls.py index 8a5a7d869de..34a56402dec 100644 --- a/app/app/urls.py +++ b/app/app/urls.py @@ -298,7 +298,7 @@ url(r'^tip/send/2/?', dashboard.tip_views.send_tip_2, name='send_tip_2'), url(r'^tip/send/?', dashboard.tip_views.send_tip, name='send_tip'), url(r'^send/?', dashboard.tip_views.send_tip, name='tip'), - url(r'^tip/?', dashboard.tip_views.send_tip, name='tip'), + url(r'^tip/?', dashboard.tip_views.send_tip_2, name='tip'), # Legal re_path(r'^terms/?', dashboard.views.terms, name='_terms'), diff --git a/app/assets/v2/js/user-search.js b/app/assets/v2/js/user-search.js index dd0d62a322d..e48a0718efa 100644 --- a/app/assets/v2/js/user-search.js +++ b/app/assets/v2/js/user-search.js @@ -92,8 +92,20 @@ function userSearch(elem, showAddress, theme, initialData, allowClear, suppress_ return selected; } - function formatUserSelectionWithAddress(user) { + function formatUserSelectionWithAddress(base_user) { let selected; + let existent_properties = {}; + + if (base_user.element) { + const attr = base_user.element.attributes; + const attr_length = attr.length; + + for (let i = 0; i < attr_length; i++) { + existent_properties[attr[i].nodeName] = attr[i].nodeValue; + } + } + + let user = $.extend({}, existent_properties, base_user); if (user.id) { selected = ` diff --git a/app/dashboard/templates/onepager/send2.html b/app/dashboard/templates/onepager/send2.html index 92ee1cfa98d..9d566b38991 100644 --- a/app/dashboard/templates/onepager/send2.html +++ b/app/dashboard/templates/onepager/send2.html @@ -89,7 +89,11 @@

{% trans "Send Tip." %}

{% trans "Where is my Eth going? " %}


- +
@@ -164,4 +168,12 @@

{% trans "with instructions about how to receive their tip." %}

{% trans "We send the funds directly to the address associated with the user." %}
+ + {% if not user_json and username %} + + {% endif %} {% endblock %} diff --git a/app/dashboard/templates/profiles/header_details.html b/app/dashboard/templates/profiles/header_details.html index 2587b120aab..d2138eab069 100644 --- a/app/dashboard/templates/profiles/header_details.html +++ b/app/dashboard/templates/profiles/header_details.html @@ -12,6 +12,9 @@

Please note - use your judgement on whether this is the right contributor for your task.

'> {% endif %} + + +

{{ profile.handle }} {% if profile.custom_tagline %} diff --git a/app/dashboard/tip_views.py b/app/dashboard/tip_views.py index 78b42843a36..9158a898617 100644 --- a/app/dashboard/tip_views.py +++ b/app/dashboard/tip_views.py @@ -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__iexact=username) + + 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)