Repository: gratipay/gratipay.com

Issue:
Simplify mailing list opt-in even further
In #4651 we dropped back to two mailing list options, quarterly and yearly. However, as I think through the way #BackTheStack is gonna wanna play out, we are going to want to send multiple updates over the course of the campaign. That's not consistent with a "quarterly" or "yearly" newsletter. I think our best bet is to just have a simple "Yes/No" on the mailing list.


Discussion:

Resolving patch:
diff --git a/gratipay/homepage.py b/gratipay/homepage.py
--- a/gratipay/homepage.py
+++ b/gratipay/homepage.py
@@ -45,10 +45,10 @@ def _parse(raw):
         email_address = email_address[:255]
         errors.append('email_address')
 
-    follow_up = x('follow_up')
-    if follow_up not in ('quarterly', 'yearly', 'never'):
-        follow_up = 'quarterly'
-        errors.append('follow_up')
+    on_mailing_list = x('on_mailing_list')
+    if on_mailing_list not in ('yes', 'no'):
+        on_mailing_list = 'yes'
+        errors.append('on_mailing_list')
 
     # promo fields
     promotion_name = x('promotion_name')
@@ -78,7 +78,7 @@ def _parse(raw):
              , 'grateful_for': grateful_for
              , 'name': name
              , 'email_address': email_address
-             , 'follow_up': follow_up
+             , 'on_mailing_list': on_mailing_list
              , 'promotion_name': promotion_name
              , 'promotion_url': promotion_url
              , 'promotion_twitter': promotion_twitter
diff --git a/gratipay/models/payment_for_open_source.py b/gratipay/models/payment_for_open_source.py
--- a/gratipay/models/payment_for_open_source.py
+++ b/gratipay/models/payment_for_open_source.py
@@ -38,20 +38,21 @@ def from_uuid(cls, uuid, cursor=None):
 
 
     @classmethod
-    def insert(cls, amount, grateful_for, name, follow_up, email_address,
+    def insert(cls, amount, grateful_for, name, on_mailing_list, email_address,
                promotion_name, promotion_url, promotion_twitter, promotion_message,
                cursor=None):
         """Take baseline info and insert into the database.
         """
         uuid = uuid4().hex
+        on_mailing_list = on_mailing_list == 'yes'
         return (cursor or cls.db).one("""
             INSERT INTO payments_for_open_source
-                        (uuid, amount, grateful_for, name, follow_up, email_address,
+                        (uuid, amount, grateful_for, name, on_mailing_list, email_address,
                          promotion_name, promotion_url, promotion_twitter, promotion_message)
                  VALUES (%s, %s, %s, %s, %s, %s,
                          %s, %s, %s, %s)
               RETURNING payments_for_open_source.*::payments_for_open_source
-        """, (uuid, amount, grateful_for, name, follow_up, email_address,
+        """, (uuid, amount, grateful_for, name, on_mailing_list, email_address,
               promotion_name, promotion_url, promotion_twitter, promotion_message))
 
 


Test patch:
diff --git a/gratipay/testing/harness.py b/gratipay/testing/harness.py
--- a/gratipay/testing/harness.py
+++ b/gratipay/testing/harness.py
@@ -148,7 +148,7 @@ def make_payment_for_open_source(self, **info):
                        , grateful_for='open source!'
                        , name='Alice Liddell'
                        , email_address='alice@example.com'
-                       , follow_up='quarterly'
+                       , on_mailing_list=True
                        , promotion_name='Wonderland'
                        , promotion_url='http://www.example.com/'
                        , promotion_twitter='thebestbutter'
diff --git a/tests/py/test_www_homepage.py b/tests/py/test_www_homepage.py
--- a/tests/py/test_www_homepage.py
+++ b/tests/py/test_www_homepage.py
@@ -19,7 +19,7 @@
        , 'grateful_for': 'python, javascript'
        , 'name': 'Alice Liddell'
        , 'email_address': 'alice@example.com'
-       , 'follow_up': 'yearly'
+       , 'on_mailing_list': 'yes'
        , 'promotion_name': 'Wonderland'
        , 'promotion_url': 'http://www.example.com/'
        , 'promotion_twitter': 'thebestbutter'
@@ -30,7 +30,7 @@
       , 'grateful_for': 'x' * (16 * 2**10) + 'x'
       , 'name': 'Alice Liddell' * 20
       , 'email_address': 'alice' * 100 + '@example.com'
-      , 'follow_up': 'cheese'
+      , 'on_mailing_list': 'cheese'
       , 'promotion_name': 'Wonderland' * 100
       , 'promotion_url': 'http://www.example.com/' + 'cheese' * 100
       , 'promotion_twitter': 'thebestbutter' * 10
@@ -41,7 +41,7 @@
           , 'grateful_for': ''
           , 'name': ''
           , 'email_address': ''
-          , 'follow_up': 'quarterly'
+          , 'on_mailing_list': 'no'
           , 'promotion_name': ''
           , 'promotion_url': ''
           , 'promotion_twitter': ''
@@ -52,13 +52,14 @@
            , 'grateful_for': 'x' * (16 * 2**10)
            , 'name': 'Alice Liddell' * 19 + 'Alice Li'
            , 'email_address': 'alice' * 51
-           , 'follow_up': 'quarterly'
+           , 'on_mailing_list': 'yes'
            , 'promotion_name': 'WonderlandWonderlandWonderlandWo'
            , 'promotion_url': 'http://www.example.com/' + 'cheese' * 38 + 'chee'
            , 'promotion_twitter': 'thebestbutterthebestbutterthebes'
            , 'promotion_message': 'Love me!' * 16
             }
-ALL = ['amount', 'payment_method_nonce', 'grateful_for', 'name', 'email_address', 'follow_up',
+ALL = ['amount', 'payment_method_nonce',
+       'grateful_for', 'name', 'email_address', 'on_mailing_list',
        'promotion_name', 'promotion_url', 'promotion_twitter', 'promotion_message']
 
 
@@ -125,7 +126,7 @@ def test_stores_info(self):
         parsed.pop('payment_method_nonce')
         assert self.fetch() is None
         _store(parsed)
-        assert self.fetch().follow_up == 'yearly'
+        assert self.fetch().on_mailing_list
 
 
 class Send(QueuedEmailHarness):