From 0ffb3bcfeefebbff0c396e56a7c53704c771e22f Mon Sep 17 00:00:00 2001 From: iamonuwa Date: Fri, 27 Dec 2019 03:19:50 +0100 Subject: [PATCH 1/2] Toggle ethereum wallet address --- .../0069_profile_hide_wallet_address.py | 18 +++++++++ .../migrations/0070_auto_20191227_0219.py | 18 +++++++++ app/dashboard/models.py | 4 ++ .../templates/profiles/header_details.html | 40 +++++++++++-------- app/grants/templates/grants/activity.html | 36 +++++++++++++---- app/grants/templates/grants/fund.html | 8 +++- app/grants/views.py | 5 +++ app/marketing/views.py | 1 + app/retail/templates/settings/privacy.html | 6 +++ 9 files changed, 110 insertions(+), 26 deletions(-) create mode 100644 app/dashboard/migrations/0069_profile_hide_wallet_address.py create mode 100644 app/dashboard/migrations/0070_auto_20191227_0219.py diff --git a/app/dashboard/migrations/0069_profile_hide_wallet_address.py b/app/dashboard/migrations/0069_profile_hide_wallet_address.py new file mode 100644 index 00000000000..af7a8f0f75e --- /dev/null +++ b/app/dashboard/migrations/0069_profile_hide_wallet_address.py @@ -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'), + ), + ] diff --git a/app/dashboard/migrations/0070_auto_20191227_0219.py b/app/dashboard/migrations/0070_auto_20191227_0219.py new file mode 100644 index 00000000000..a2e4104698a --- /dev/null +++ b/app/dashboard/migrations/0070_auto_20191227_0219.py @@ -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'), + ), + ] diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 3370559e49b..7daee18a852 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -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', diff --git a/app/dashboard/templates/profiles/header_details.html b/app/dashboard/templates/profiles/header_details.html index 254f964e848..897602f61ca 100644 --- a/app/dashboard/templates/profiles/header_details.html +++ b/app/dashboard/templates/profiles/header_details.html @@ -64,26 +64,32 @@

{% 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 %} {% if profile.preferred_payout_address %} -
- - {{ profile.preferred_payout_address }} - {% if is_my_profile %} - Update preferred address - {% endif %} -
+
+ + {{ profile.preferred_payout_address }} + {% if is_my_profile %} + Update preferred address + {% endif %} +
{% else %} -
- {% if is_my_profile %} - Add a preferred address - {% elif not profile.is_org %} - No preferred address - {% endif %} -
+
+ {% if is_my_profile %} + Add a preferred address + {% elif not profile.is_org %} + No preferred address + {% endif %} +
{% endif %} +{% elif user.has_done_business_with %} +
+ + {{ profile.preferred_payout_address }} + {% if is_my_profile %} + Update preferred address + {% endif %} +
{% endif %} {% if not profile.is_org %}
diff --git a/app/grants/templates/grants/activity.html b/app/grants/templates/grants/activity.html index 5cc4f1cb8ca..e23a0ec693e 100644 --- a/app/grants/templates/grants/activity.html +++ b/app/grants/templates/grants/activity.html @@ -78,13 +78,23 @@ {% if not transaction.success %} (Failed) {% endif %}
- + {% if not profile.hide_wallet_address %} + + {% elif subscription.contributor_profile.has_done_business_with %} + + {% endif %}

@@ -135,7 +145,8 @@ {{subscription.num_tx_approved|floatformat}} time{{ subscription.num_tx_approved|pluralize }}

-
+ {% if not profile.hide_wallet_address %} +
{% if subscription.cancel_tx_id != '0x0' %} {% if transaction.cancel_tx_id %} @@ -144,6 +155,15 @@ {% endif %}
+ {% elif subscription.contributor_profile.has_done_business_with %} + + {% endif %}

diff --git a/app/grants/templates/grants/fund.html b/app/grants/templates/grants/fund.html index a4d67aad421..1194c780072 100644 --- a/app/grants/templates/grants/fund.html +++ b/app/grants/templates/grants/fund.html @@ -189,7 +189,7 @@

{% trans "Fund Grant" %}

-
+

{% trans "Support Gitcoin" %}

@@ -229,6 +229,12 @@

{% trans "Support Gitcoin" %}

+
+ + +
+ {% trans "If this option is chosen, your wallet addres will be hidden" %} +
diff --git a/app/grants/views.py b/app/grants/views.py index 145c5456f2c..239879f530f 100644 --- a/app/grants/views.py +++ b/app/grants/views.py @@ -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', '') @@ -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'), diff --git a/app/marketing/views.py b/app/marketing/views.py index 37f29d2b6f5..c4acf2395e4 100644 --- a/app/marketing/views.py +++ b/app/marketing/views.py @@ -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() diff --git a/app/retail/templates/settings/privacy.html b/app/retail/templates/settings/privacy.html index a640605b41e..51ea7f23fce 100644 --- a/app/retail/templates/settings/privacy.html +++ b/app/retail/templates/settings/privacy.html @@ -17,6 +17,12 @@
{% trans "Privacy Preferences" %}

{% trans "If this option is chosen, we will remove your profile altogether" %}
+
+ + +
+ {% trans "If this option is chosen, we will remove your wallet address" %} +
{% if profile.alumni.exists %}
From e05b3c702ed0c0c5baa91d728d2cafd20b55012a Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Mon, 30 Dec 2019 21:25:18 +0530 Subject: [PATCH 2/2] addressed review comments --- .../0069_profile_hide_wallet_address.py | 4 +- .../migrations/0070_auto_20191227_0219.py | 18 ------- .../templates/profiles/header_details.html | 54 ++++++++++--------- app/grants/templates/grants/activity.html | 18 +++---- app/retail/templates/settings/privacy.html | 4 +- 5 files changed, 42 insertions(+), 56 deletions(-) delete mode 100644 app/dashboard/migrations/0070_auto_20191227_0219.py diff --git a/app/dashboard/migrations/0069_profile_hide_wallet_address.py b/app/dashboard/migrations/0069_profile_hide_wallet_address.py index af7a8f0f75e..bd288ef276e 100644 --- a/app/dashboard/migrations/0069_profile_hide_wallet_address.py +++ b/app/dashboard/migrations/0069_profile_hide_wallet_address.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.4 on 2019-12-27 00:47 +# Generated by Django 2.2.4 on 2019-12-30 15:49 from django.db import migrations, models @@ -13,6 +13,6 @@ class Migration(migrations.Migration): 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'), + field=models.BooleanField(default=True, help_text='If this option is chosen, we will remove your wallet information all together'), ), ] diff --git a/app/dashboard/migrations/0070_auto_20191227_0219.py b/app/dashboard/migrations/0070_auto_20191227_0219.py deleted file mode 100644 index a2e4104698a..00000000000 --- a/app/dashboard/migrations/0070_auto_20191227_0219.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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'), - ), - ] diff --git a/app/dashboard/templates/profiles/header_details.html b/app/dashboard/templates/profiles/header_details.html index 897602f61ca..06343418b1f 100644 --- a/app/dashboard/templates/profiles/header_details.html +++ b/app/dashboard/templates/profiles/header_details.html @@ -19,7 +19,8 @@

'> {% endif %}

-

{{ profile.handle }} +

+ {{ profile.handle }} {% if profile.custom_tagline %} - {{ profile.custom_tagline }} {% endif %} @@ -65,32 +66,33 @@

{% endif %} {% if not profile.hide_wallet_address %} -{% if profile.preferred_payout_address %} -
- - {{ profile.preferred_payout_address }} - {% if is_my_profile %} - Update preferred address + {% if profile.preferred_payout_address %} +
+ + {{ profile.preferred_payout_address }} + {% if is_my_profile %} + Update preferred address + {% endif %} +
+ {% else %} +
+ {% if is_my_profile %} + Add a preferred address + {% elif not profile.is_org %} + No preferred address + {% endif %} +
{% endif %} -
-{% else %} -
- {% if is_my_profile %} - Add a preferred address - {% elif not profile.is_org %} - No preferred address - {% endif %} -
-{% endif %} {% elif user.has_done_business_with %} -
- - {{ profile.preferred_payout_address }} - {% if is_my_profile %} - Update preferred address - {% endif %} -
+
+ + {{ profile.preferred_payout_address }} + {% if is_my_profile %} + Update preferred address + {% endif %} +
{% endif %} + {% if not profile.is_org %}
{% for i in ratings %} @@ -99,9 +101,9 @@

({{ avg_rating.total_rating }} {% trans "rating" %}{{avg_rating.total_rating | pluralize}})

{% endif %} + {% if profile.show_job_status %}
{{ profile.job_status_verbose }}
-{% endif %} -

+{% endif %} \ No newline at end of file diff --git a/app/grants/templates/grants/activity.html b/app/grants/templates/grants/activity.html index e23a0ec693e..f6f67733a3e 100644 --- a/app/grants/templates/grants/activity.html +++ b/app/grants/templates/grants/activity.html @@ -34,8 +34,8 @@ @@ -159,8 +159,8 @@ {% endif %} diff --git a/app/retail/templates/settings/privacy.html b/app/retail/templates/settings/privacy.html index 51ea7f23fce..b40e6124106 100644 --- a/app/retail/templates/settings/privacy.html +++ b/app/retail/templates/settings/privacy.html @@ -21,7 +21,9 @@
{% trans "Privacy Preferences" %}

- {% trans "If this option is chosen, we will remove your wallet address" %} + + {% trans "If this option is chosen, your wallet address will be visible only to user's you've previously done business with on Gitcoin" %} +
{% if profile.alumni.exists %}