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

Toggle ethereum wallet address #5689

Merged
merged 2 commits into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions app/dashboard/migrations/0069_profile_hide_wallet_address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.4 on 2019-12-27 00:47

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0068_auto_20191211_1458'),
]

operations = [
migrations.AddField(
model_name='profile',
name='hide_wallet_address',
field=models.BooleanField(default=True, help_text='If this option is chosen, we will remove your wallet information from the grants page'),
),
]
18 changes: 18 additions & 0 deletions app/dashboard/migrations/0070_auto_20191227_0219.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.4 on 2019-12-27 02:19

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0069_profile_hide_wallet_address'),
]

operations = [
migrations.AlterField(
model_name='profile',
name='hide_wallet_address',
field=models.BooleanField(default=True, help_text='If this option is chosen, we will remove your wallet information all together'),
),
]
4 changes: 4 additions & 0 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2330,6 +2330,10 @@ class Profile(SuperModel):
default=True,
help_text='If this option is chosen, we will remove your profile information all_together',
)
hide_wallet_address = models.BooleanField(
default=True,
help_text='If this option is chosen, we will remove your wallet information all together',
)
trust_profile = models.BooleanField(
default=False,
help_text='If this option is chosen, the user is able to submit a faucet/ens domain registration even if they are new to github',
Expand Down
40 changes: 23 additions & 17 deletions app/dashboard/templates/profiles/header_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,32 @@ <h1 class="profile-header__handle">
<button class="btn btn-gc-blue btn-sm" data-jointribe="{{profile.handle}}">Join Tribe</button>
{% endif %}


{% if 0 %}
TODO: Re-enable this when we have proper privacy in place a la https://github.com/gitcoinco/web/issues/5654
{% if not profile.hide_wallet_address %}
iamonuwa marked this conversation as resolved.
Show resolved Hide resolved
{% if profile.preferred_payout_address %}
thelostone-mc marked this conversation as resolved.
Show resolved Hide resolved
<div class="my-2">
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="16" class="mr-2 mb-1"><path fill="#000" fill-rule="nonzero" d="M10 8.113L5.002 11 0 8.113 5.002 0 10 8.113zm-5 3.821L0 9l5 7 5-7-5 2.934z"/></svg>
<span id="preferred-address" data-truncatehash title="{{ profile.preferred_payout_address }}">{{ profile.preferred_payout_address }}</span>
{% if is_my_profile %}
<a href="/settings/account" class=""><i class="fas fa-plus-circle"></i> Update preferred address</a>
{% endif %}
</div>
<div class="my-2">
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="16" class="mr-2 mb-1"><path fill="#000" fill-rule="nonzero" d="M10 8.113L5.002 11 0 8.113 5.002 0 10 8.113zm-5 3.821L0 9l5 7 5-7-5 2.934z"/></svg>
<span id="preferred-address" data-truncatehash title="{{ profile.preferred_payout_address }}">{{ profile.preferred_payout_address }}</span>
{% if is_my_profile %}
<a href="/settings/account" class=""><i class="fas fa-plus-circle"></i> Update preferred address</a>
{% endif %}
</div>
{% else %}
<div class="my-2" id="preferred-address">
{% if is_my_profile %}
<a href="/settings/account" class=""><i class="fas fa-plus-circle"></i> Add a preferred address</a>
{% elif not profile.is_org %}
No preferred address
{% endif %}
</div>
<div class="my-2" id="preferred-address">
{% if is_my_profile %}
<a href="/settings/account" class=""><i class="fas fa-plus-circle"></i> Add a preferred address</a>
{% elif not profile.is_org %}
No preferred address
{% endif %}
</div>
{% endif %}
{% elif user.has_done_business_with %}
<div class="my-2">
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="16" class="mr-2 mb-1"><path fill="#000" fill-rule="nonzero" d="M10 8.113L5.002 11 0 8.113 5.002 0 10 8.113zm-5 3.821L0 9l5 7 5-7-5 2.934z"/></svg>
<span id="preferred-address" data-truncatehash title="{{ profile.preferred_payout_address }}">{{ profile.preferred_payout_address }}</span>
{% if is_my_profile %}
<a href="/settings/account" class=""><i class="fas fa-plus-circle"></i> Update preferred address</a>
{% endif %}
</div>
{% endif %}
{% if not profile.is_org %}
<div class="static-stars my-3">
Expand Down
36 changes: 28 additions & 8 deletions app/grants/templates/grants/activity.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,23 @@
{% if not transaction.success %} (Failed) {% endif %}
</div>
</div>
<div class="d-none d-md-block col-md-2 font-body my-auto txn-link">
<a class="tx_link" href="https://etherscan.io/tx/{{ transaction.tx_id }}" target="_blank" rel="noopener noreferrer">
{% if transaction.tx_id %}
View Etherscan
{%endif%}
</a>
</div>
{% if not profile.hide_wallet_address %}
<div class="d-none d-md-block col-md-2 font-body my-auto txn-link">
<a class="tx_link" href="https://etherscan.io/tx/{{ transaction.tx_id }}" target="_blank" rel="noopener noreferrer">
{% if transaction.tx_id %}
View Etherscan
thelostone-mc marked this conversation as resolved.
Show resolved Hide resolved
{%endif%}
thelostone-mc marked this conversation as resolved.
Show resolved Hide resolved
</a>
</div>
{% elif subscription.contributor_profile.has_done_business_with %}
<div class="d-none d-md-block col-md-2 font-body my-auto txn-link">
<a class="tx_link" href="https://etherscan.io/tx/{{ transaction.tx_id }}" target="_blank" rel="noopener noreferrer">
{% if transaction.tx_id %}
View Etherscan
{%endif%}
</a>
</div>
{% endif %}
<div class="offset-lg-1 col-4 col-md-2 my-auto tags font-caption">
<div class="tag tag-lg token">
<p>
Expand Down Expand Up @@ -135,7 +145,8 @@
{{subscription.num_tx_approved|floatformat}} time{{ subscription.num_tx_approved|pluralize }}
</div>
</div>
<div class="d-none d-md-block col-md-2 my-auto font-body">
{% if not profile.hide_wallet_address %}
<div class="d-none d-md-block col-md-2 my-auto font-body">
{% if subscription.cancel_tx_id != '0x0' %}
<a class="cancel_tx_link" href="https://etherscan.io/tx/{{ subscription.cancel_tx_id }}" target="_blank" rel="noopener noreferrer">
{% if transaction.cancel_tx_id %}
Expand All @@ -144,6 +155,15 @@
</a>
{% endif %}
</div>
{% elif subscription.contributor_profile.has_done_business_with %}
<div class="d-none d-md-block col-md-2 font-body my-auto txn-link">
<a class="tx_link" href="https://etherscan.io/tx/{{ transaction.tx_id }}" target="_blank" rel="noopener noreferrer">
{% if transaction.tx_id %}
View Etherscan
{%endif%}
</a>
</div>
{% endif %}
<div class="col-4 col-md-2 offset-lg-1 my-auto tags font-caption">
<div class="tag tag-lg token">
<p>
Expand Down
8 changes: 7 additions & 1 deletion app/grants/templates/grants/fund.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ <h2 class="font-title-lg my-4">{% trans "Fund Grant" %}</h2>
</div>
</div>

<div id="gitcoin-grant-section" class="form__group-horizontal my-5">
<div id="gitcoin-grant-section" class="form__group-horizontal mt-5 mb-2">
<div class="row">
<div class="col-12 mb-3">
<h2 class="font-subheader font-weight-semibold">{% trans "Support Gitcoin" %}</h2>
Expand Down Expand Up @@ -229,6 +229,12 @@ <h2 class="font-subheader font-weight-semibold">{% trans "Support Gitcoin" %}</h
</div>
</div>
</div>
<div class="mb-4">
<input type="checkbox" name="hide_wallet_address" id=hide_wallet_address {% if profile.hide_wallet_address %} checked="checked" {% endif %} >
<label class="form__label" for="hide_wallet_address">{% trans "Hide my wallet address" %}</label>
<br>
<small id="hide_wallet_address_help" class="form__input-help">{% trans "If this option is chosen, your wallet addres will be hidden" %}</small>
</div>

<div id="gas-section" class="form__group-horizontal">
<div class="row">
Expand Down
5 changes: 5 additions & 0 deletions app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ def grant_fund(request, grant_id, grant_slug):
return JsonResponse({
'success': True,
})

if 'hide_wallet_address' in request.POST:
profile.hide_wallet_address = bool(request.POST.get('hide_wallet_address', False))
profile.save()

if 'signature' in request.POST:
sub_new_approve_tx_id = request.POST.get('sub_new_approve_tx_id', '')
Expand Down Expand Up @@ -660,6 +664,7 @@ def grant_fund(request, grant_id, grant_slug):
is_phantom_funding_this_grant = not is_phantom_funding_this_grant

params = {
'profile': profile,
'active': 'fund_grant',
'title': _('Fund Grant'),
'card_desc': _('Provide sustainable funding for Open Source with Gitcoin Grants'),
Expand Down
1 change: 1 addition & 0 deletions app/marketing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def privacy_settings(request):
if profile:
profile.suppress_leaderboard = bool(request.POST.get('suppress_leaderboard', False))
profile.hide_profile = bool(request.POST.get('hide_profile', False))
profile.hide_wallet_address = bool(request.POST.get('hide_wallet_address', False))
profile = record_form_submission(request, profile, 'privacy')
if profile.alumni and profile.alumni.exists():
alumni = profile.alumni.first()
Expand Down
6 changes: 6 additions & 0 deletions app/retail/templates/settings/privacy.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ <h5>{% trans "Privacy Preferences" %}</h5>
<br>
<small id="hide_profile_help" class="form__input-help">{% trans "If this option is chosen, we will remove your profile altogether" %}</small>
</div>
<div>
<input type="checkbox" name="hide_wallet_address" id=hide_wallet_address {% if profile.hide_wallet_address %} checked="checked" {% endif %} {% if not is_logged_in %} disabled {% endif %} >
<label class="form__label" for="hide_wallet_address">{% trans "Hide my wallet address" %}</label>
<br>
<small id="hide_wallet_address_help" class="form__input-help">{% trans "If this option is chosen, we will remove your wallet address" %}</small>
thelostone-mc marked this conversation as resolved.
Show resolved Hide resolved
</div>
{% if profile.alumni.exists %}
<div>
<input type="checkbox" name="hide_alumni" id=hide_alumni value="1" {% if not profile.alumni.first.public %} checked="checked" {% endif %} {% if not is_logged_in %} disabled {% endif %} >
Expand Down