From b549562a4d78f45f00e5f1fbdf661939a5feb829 Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Tue, 14 Jan 2025 22:49:41 +0530 Subject: [PATCH] sponsorship: Ask user how they plan to use Zulip. This will help avoid some back-and-forth on sponsorship requests. --- corporate/lib/stripe.py | 3 +++ corporate/lib/support.py | 2 ++ ...zulipsponsorshiprequest_plan_to_use_zulip.py | 17 +++++++++++++++++ corporate/models.py | 1 + corporate/tests/test_stripe.py | 5 +++++ corporate/tests/test_support_views.py | 1 + templates/corporate/billing/sponsorship.html | 6 ++++++ .../zerver/emails/sponsorship_request.html | 6 ++++++ templates/zerver/emails/sponsorship_request.txt | 3 +++ web/src/billing/sponsorship.ts | 9 +++++++++ 10 files changed, 53 insertions(+) create mode 100644 corporate/migrations/0045_zulipsponsorshiprequest_plan_to_use_zulip.py diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py index b2e3df8c19..30019a884e 100644 --- a/corporate/lib/stripe.py +++ b/corporate/lib/stripe.py @@ -696,6 +696,7 @@ class SponsorshipRequestForm(forms.Form): organization_type = forms.IntegerField() description = forms.CharField(widget=forms.Textarea) expected_total_users = forms.CharField(widget=forms.Textarea) + plan_to_use_zulip = forms.CharField(widget=forms.Textarea) paid_users_count = forms.CharField(widget=forms.Textarea) paid_users_description = forms.CharField(widget=forms.Textarea, required=False) requested_plan = forms.ChoiceField( @@ -3498,6 +3499,7 @@ class BillingSession(ABC): org_description=form.cleaned_data["description"], org_type=form.cleaned_data["organization_type"], expected_total_users=form.cleaned_data["expected_total_users"], + plan_to_use_zulip=form.cleaned_data["plan_to_use_zulip"], paid_users_count=form.cleaned_data["paid_users_count"], paid_users_description=form.cleaned_data["paid_users_description"], requested_plan=form.cleaned_data["requested_plan"], @@ -3526,6 +3528,7 @@ class BillingSession(ABC): "website": sponsorship_request.org_website, "description": sponsorship_request.org_description, "expected_total_users": sponsorship_request.expected_total_users, + "plan_to_use_zulip": sponsorship_request.plan_to_use_zulip, "paid_users_count": sponsorship_request.paid_users_count, "paid_users_description": sponsorship_request.paid_users_description, "requested_plan": sponsorship_request.requested_plan, diff --git a/corporate/lib/support.py b/corporate/lib/support.py index e6c214e831..16984a8970 100644 --- a/corporate/lib/support.py +++ b/corporate/lib/support.py @@ -50,6 +50,7 @@ class SponsorshipRequestDict(TypedDict): org_type: str org_website: str org_description: str + plan_to_use_zulip: str total_users: str paid_users: str paid_users_description: str @@ -185,6 +186,7 @@ def get_customer_sponsorship_data(customer: Customer) -> SponsorshipData: org_website=website, org_description=last_sponsorship_request.org_description, total_users=last_sponsorship_request.expected_total_users, + plan_to_use_zulip=last_sponsorship_request.plan_to_use_zulip, paid_users=last_sponsorship_request.paid_users_count, paid_users_description=last_sponsorship_request.paid_users_description, requested_plan=last_sponsorship_request.requested_plan, diff --git a/corporate/migrations/0045_zulipsponsorshiprequest_plan_to_use_zulip.py b/corporate/migrations/0045_zulipsponsorshiprequest_plan_to_use_zulip.py new file mode 100644 index 0000000000..faa0783211 --- /dev/null +++ b/corporate/migrations/0045_zulipsponsorshiprequest_plan_to_use_zulip.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0.10 on 2025-01-14 17:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("corporate", "0001_squashed_0044_convert_ids_to_bigints"), + ] + + operations = [ + migrations.AddField( + model_name="zulipsponsorshiprequest", + name="plan_to_use_zulip", + field=models.TextField(default=""), + ), + ] diff --git a/corporate/models.py b/corporate/models.py index 69eb4b4ad5..22f7b9e9ae 100644 --- a/corporate/models.py +++ b/corporate/models.py @@ -576,6 +576,7 @@ class ZulipSponsorshipRequest(models.Model): org_description = models.TextField(default="") expected_total_users = models.TextField(default="") + plan_to_use_zulip = models.TextField(default="") paid_users_count = models.TextField(default="") paid_users_description = models.TextField(default="") diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py index d9edb76a78..6ef6c1027d 100644 --- a/corporate/tests/test_stripe.py +++ b/corporate/tests/test_stripe.py @@ -2456,6 +2456,7 @@ class StripeTest(StripeTestCase): "website": "invalid-url", "description": "Infinispan is a distributed in-memory key/value data store with optional schema.", "expected_total_users": "10 users", + "plan_to_use_zulip": "For communication on moon.", "paid_users_count": "1 user", "paid_users_description": "We have 1 paid user.", } @@ -2472,6 +2473,7 @@ class StripeTest(StripeTestCase): "website": "", "description": "Infinispan is a distributed in-memory key/value data store with optional schema.", "expected_total_users": "10 users", + "plan_to_use_zulip": "For communication on moon.", "paid_users_count": "1 user", "paid_users_description": "We have 1 paid user.", } @@ -2570,6 +2572,7 @@ class StripeTest(StripeTestCase): "website": "https://infinispan.org/", "description": "Infinispan is a distributed in-memory key/value data store with optional schema.", "expected_total_users": "10 users", + "plan_to_use_zulip": "For communication on moon.", "paid_users_count": "1 user", "paid_users_description": "We have 1 paid user.", } @@ -8299,6 +8302,7 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase): "website": "https://infinispan.org/", "description": "Infinispan is a distributed in-memory key/value data store with optional schema.", "expected_total_users": "10 users", + "plan_to_use_zulip": "For communication on moon.", "paid_users_count": "1 user", "paid_users_description": "We have 1 paid user.", "requested_plan": "Community", @@ -8926,6 +8930,7 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase): "website": "https://infinispan.org/", "description": "Infinispan is a distributed in-memory key/value data store with optional schema.", "expected_total_users": "10 users", + "plan_to_use_zulip": "For communication on moon.", "paid_users_count": "1 user", "paid_users_description": "We have 1 paid user.", "requested_plan": "Community", diff --git a/corporate/tests/test_support_views.py b/corporate/tests/test_support_views.py index c9c46a7679..09461e5aef 100644 --- a/corporate/tests/test_support_views.py +++ b/corporate/tests/test_support_views.py @@ -65,6 +65,7 @@ class TestRemoteServerSupportEndpoint(ZulipTestCase): org_website=website, org_description="We help people.", expected_total_users="20-35", + plan_to_use_zulip="For communication on moon.", paid_users_count=paid_users, paid_users_description="", requested_plan=plan, diff --git a/templates/corporate/billing/sponsorship.html b/templates/corporate/billing/sponsorship.html index f04f1c9515..97d01cc067 100644 --- a/templates/corporate/billing/sponsorship.html +++ b/templates/corporate/billing/sponsorship.html @@ -150,6 +150,12 @@
+
+ + +
+
diff --git a/templates/zerver/emails/sponsorship_request.html b/templates/zerver/emails/sponsorship_request.html index b9ceeac215..f1b96942bd 100644 --- a/templates/zerver/emails/sponsorship_request.html +++ b/templates/zerver/emails/sponsorship_request.html @@ -29,6 +29,12 @@

+How do you plan to use Zulip? +
+{{ plan_to_use_zulip }} + +

+ Expected users: {{ expected_total_users }}

diff --git a/templates/zerver/emails/sponsorship_request.txt b/templates/zerver/emails/sponsorship_request.txt index 480a5880d0..8cdb14bafe 100644 --- a/templates/zerver/emails/sponsorship_request.txt +++ b/templates/zerver/emails/sponsorship_request.txt @@ -7,6 +7,9 @@ Organization type: {{ organization_type }} Description: {{ description }} +How do you plan to use Zulip? +{{ plan_to_use_zulip }} + Expected users: - Total: {{ expected_total_users }} - Paid: {{ paid_users_count }} diff --git a/web/src/billing/sponsorship.ts b/web/src/billing/sponsorship.ts index 16f4c3f459..b458836a8c 100644 --- a/web/src/billing/sponsorship.ts +++ b/web/src/billing/sponsorship.ts @@ -44,6 +44,15 @@ function validate_data(data: helpers.FormDataObject): boolean { hide_submit_loading_indicator(); found_error = true; } + + assert(data.plan_to_use_zulip !== undefined); + if (data.plan_to_use_zulip.trim() === "") { + $("#sponsorship-plan-to-use-zulip-error").text( + "Description of how you plan to use Zulip cannot be blank.", + ); + hide_submit_loading_indicator(); + found_error = true; + } return !found_error; }