From f7b136049df2d27230004f74979e9b56199fe252 Mon Sep 17 00:00:00 2001 From: owocki Date: Mon, 25 Jan 2021 13:33:08 -0700 Subject: [PATCH 1/3] adds an is_pro flag to the profile --- app/app/context.py | 1 + app/assets/v2/js/pages/new_bounty.js | 2 +- .../migrations/0169_bounty_is_pro.py | 19 +++++++++++++++++++ app/dashboard/models.py | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 app/dashboard/migrations/0169_bounty_is_pro.py diff --git a/app/app/context.py b/app/app/context.py index de182d5173c..c9747febb8d 100644 --- a/app/app/context.py +++ b/app/app/context.py @@ -167,6 +167,7 @@ def preprocess(request): 'fortmatic_test_key': settings.FORTMATIC_TEST_KEY, 'orgs': profile.organizations if profile else [], 'profile_id': profile.id if profile else '', + 'is_pro': profile.is_pro if profile else False, 'hotjar': settings.HOTJAR_CONFIG, 'ipfs_config': { 'host': settings.JS_IPFS_HOST, diff --git a/app/assets/v2/js/pages/new_bounty.js b/app/assets/v2/js/pages/new_bounty.js index 60644226726..8fd6147b1aa 100644 --- a/app/assets/v2/js/pages/new_bounty.js +++ b/app/assets/v2/js/pages/new_bounty.js @@ -736,7 +736,7 @@ if (document.getElementById('gc-hackathon-new-bounty')) { bountyFee: document.FEE_PERCENTAGE, orgSelected: '', subscriptions: document.subscriptions, - subscriptionActive: document.subscriptions.length, + subscriptionActive: document.subscriptions.length || document.contxt.is_pro, coinValue: null, usdFeaturedPrice: 12, ethFeaturedPrice: null, diff --git a/app/dashboard/migrations/0169_bounty_is_pro.py b/app/dashboard/migrations/0169_bounty_is_pro.py new file mode 100644 index 00000000000..216d9bb365a --- /dev/null +++ b/app/dashboard/migrations/0169_bounty_is_pro.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.4 on 2021-01-25 20:32 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0168_auto_20201216_2058'), + ] + + operations = [ + migrations.AddField( + model_name='bounty', + name='is_pro', + field=models.BooleanField(default=False, help_text='Is this use upgraded to pro?'), + preserve_default=False, + ), + ] diff --git a/app/dashboard/models.py b/app/dashboard/models.py index f085cfc6e5c..426b27b1c9f 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -397,6 +397,7 @@ class Bounty(SuperModel): default=False, help_text=_('This bounty will be part of the hypercharged bounties') ) hyper_next_publication = models.DateTimeField(null=True, blank=True) + is_pro = models.BooleanField(help_text=_('Is this use upgraded to pro?')) # Bounty QuerySet Manager objects = BountyQuerySet.as_manager() From ba14183f3f0016013058cbfc136ec505df2b9023 Mon Sep 17 00:00:00 2001 From: owocki Date: Thu, 28 Jan 2021 11:54:50 -0700 Subject: [PATCH 2/3] feedback --- .../{0169_bounty_is_pro.py => 0169_profile_is_pro.py} | 6 +++--- app/dashboard/models.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename app/dashboard/migrations/{0169_bounty_is_pro.py => 0169_profile_is_pro.py} (75%) diff --git a/app/dashboard/migrations/0169_bounty_is_pro.py b/app/dashboard/migrations/0169_profile_is_pro.py similarity index 75% rename from app/dashboard/migrations/0169_bounty_is_pro.py rename to app/dashboard/migrations/0169_profile_is_pro.py index 216d9bb365a..7c4de999314 100644 --- a/app/dashboard/migrations/0169_bounty_is_pro.py +++ b/app/dashboard/migrations/0169_profile_is_pro.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.4 on 2021-01-25 20:32 +# Generated by Django 2.2.4 on 2021-01-28 18:54 from django.db import migrations, models @@ -11,9 +11,9 @@ class Migration(migrations.Migration): operations = [ migrations.AddField( - model_name='bounty', + model_name='profile', name='is_pro', - field=models.BooleanField(default=False, help_text='Is this use upgraded to pro?'), + field=models.BooleanField(default=False, help_text='Is this user upgraded to pro?'), preserve_default=False, ), ] diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 426b27b1c9f..22fc4e3a229 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -397,7 +397,6 @@ class Bounty(SuperModel): default=False, help_text=_('This bounty will be part of the hypercharged bounties') ) hyper_next_publication = models.DateTimeField(null=True, blank=True) - is_pro = models.BooleanField(help_text=_('Is this use upgraded to pro?')) # Bounty QuerySet Manager objects = BountyQuerySet.as_manager() @@ -2942,6 +2941,7 @@ class Profile(SuperModel): interests = ArrayField(models.CharField(max_length=200), blank=True, default=list) products_choose = ArrayField(models.CharField(max_length=200), blank=True, default=list) contact_email = models.EmailField(max_length=255, blank=True) + is_pro = models.BooleanField(help_text=_('Is this user upgraded to pro?')) # Idena fields is_idena_connected = models.BooleanField(default=False) From fdefd460786c7916812f4fe0ad85b7d31b1ff092 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Mon, 1 Feb 2021 14:45:11 +0530 Subject: [PATCH 3/3] recreate migration files --- .../migrations/0170_profile_is_pro.py | 18 ++++++++++++++++++ app/dashboard/models.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 app/dashboard/migrations/0170_profile_is_pro.py diff --git a/app/dashboard/migrations/0170_profile_is_pro.py b/app/dashboard/migrations/0170_profile_is_pro.py new file mode 100644 index 00000000000..ceed58b889c --- /dev/null +++ b/app/dashboard/migrations/0170_profile_is_pro.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.4 on 2021-02-01 09:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0169_profile_mautic_id'), + ] + + operations = [ + migrations.AddField( + model_name='profile', + name='is_pro', + field=models.BooleanField(default=False, help_text='Is this user upgraded to pro?'), + ), + ] diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 56bf0f0b64e..06482b7ddc1 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -2941,7 +2941,7 @@ class Profile(SuperModel): interests = ArrayField(models.CharField(max_length=200), blank=True, default=list) products_choose = ArrayField(models.CharField(max_length=200), blank=True, default=list) contact_email = models.EmailField(max_length=255, blank=True) - is_pro = models.BooleanField(help_text=_('Is this user upgraded to pro?')) + is_pro = models.BooleanField(default=False, help_text=_('Is this user upgraded to pro?')) mautic_id = models.CharField(max_length=128, null=True, blank=True, db_index=True, help_text=_('Mautic id to be able to do api requests without user being logged')) # Idena fields