From e2e67e7839de9b5d5757baf362d0a2f6350e92ee Mon Sep 17 00:00:00 2001
From: Chad Whitacre
Date: Fri, 6 Jun 2014 12:11:48 -0400
Subject: [PATCH 08/23] Clarify wording around what's deleted on close
---
www/%username/account/close.spt | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/www/%username/account/close.spt b/www/%username/account/close.spt
index 34ca1ca38d..b7658890ee 100644
--- a/www/%username/account/close.spt
+++ b/www/%username/account/close.spt
@@ -63,19 +63,19 @@ if POST:
Personal Information
-
Most of your personal information will be deleted
+
Almost all of your personal information will be deleted
immediately, including your "making the world better"
- statement, the tips you're receiving, the tips you're giving,
- any bank account or credit card, and any linked accounts that
- aren't used for sign-in. You'll also be removed from any
- communities and teams you were a part of. If you're closing a
- team account, then all team members will be removed from the
- team.
-
-
We won't delete your past giving and receiving
- history on the site, because that information also belongs
- equally to other users (the ones you gave to and received
- from).
+ statement, any funding goal, the tips you're receiving, the
+ tips you're giving, any bank account or credit card, and any
+ linked accounts that aren't used for sign-in. You'll also be
+ removed from any communities and teams you were a part of. If
+ you're closing a team account, then all team members will be
+ removed from the team.
+
+
What we don't delete is your past giving and
+ receiving history on the site, because that information also
+ belongs equally to other users (the ones you gave to and
+ received from).
After you close your account, your profile page will say,
"Account closed by user."
+{% endblock %}
From 376f939fd45dc07f3953bd48e1bb7093a9f1d747 Mon Sep 17 00:00:00 2001
From: Chad Whitacre
Date: Tue, 10 Jun 2014 10:19:45 -0400
Subject: [PATCH 14/23] Tweak language on close page
---
www/%username/account/close.spt | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/www/%username/account/close.spt b/www/%username/account/close.spt
index b7658890ee..56ead13bbc 100644
--- a/www/%username/account/close.spt
+++ b/www/%username/account/close.spt
@@ -52,10 +52,9 @@ if POST:
Username
We may give your username to someone else if they ask for
- it, but not for at least a year after you close your account.
-
-
Though if we determine that you've been infringing a
- trademark, we may give your username away sooner.
+ it, but not for at least a year after you close your account
+ (unless we determine that you've been infringing a
+ trademark).
Until we give your username to someone else, you can use it
again if you ever decide to rejoin Gittip. Simply sign in.
From ce89b1fdbdac05bce38ba88b450b03bdb0547cb9 Mon Sep 17 00:00:00 2001
From: Chad Whitacre
Date: Tue, 10 Jun 2014 13:16:37 -0400
Subject: [PATCH 15/23] Dial back language on Close to be more accurate
We're not able to deliver on strong "we delete all your info" promises
yet, because we haven't formalized a data retention policy (#397).
---
www/%username/account/close.spt | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/www/%username/account/close.spt b/www/%username/account/close.spt
index 56ead13bbc..941b029914 100644
--- a/www/%username/account/close.spt
+++ b/www/%username/account/close.spt
@@ -62,16 +62,20 @@ if POST:
Personal Information
-
Almost all of your personal information will be deleted
- immediately, including your "making the world better"
- statement, any funding goal, the tips you're receiving, the
- tips you're giving, any bank account or credit card, and any
- linked accounts that aren't used for sign-in. You'll also be
+
We immediately clear out most of the information in your
+ profile (though it may still exist in our database in event
+ logs, to be cleared eventually once we sort out our data
+ retention policy).
+
+
Things we clear immediately include your “making the
+ world better” statement, any funding goal, the tips
+ you're receiving, and those you're giving. You'll also be
removed from any communities and teams you were a part of. If
- you're closing a team account, then all team members will be
- removed from the team.
+ you're closing a team account, all team members will be removed
+ from the team.
-
What we don't delete is your past giving and
+
We specifically don't delete your past giving and
receiving history on the site, because that information also
belongs equally to other users (the ones you gave to and
received from).
From 8541ed294fe95ee8257f4d8cb9c3a85bab19c4b6 Mon Sep 17 00:00:00 2001
From: Chad Whitacre
Date: Wed, 11 Jun 2014 12:37:47 -0400
Subject: [PATCH 16/23] Tweak language on close page
---
www/%username/account/close.spt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/www/%username/account/close.spt b/www/%username/account/close.spt
index 941b029914..6ffe9fb6be 100644
--- a/www/%username/account/close.spt
+++ b/www/%username/account/close.spt
@@ -64,7 +64,7 @@ if POST:
We immediately clear out most of the information in your
profile (though it may still exist in our database in event
- logs, to be cleared eventually once we sort out our data
retention policy).
From 607af9b77bd335d5a7dfeb64d432e3a9d95160e5 Mon Sep 17 00:00:00 2001
From: Chad Whitacre
Date: Wed, 11 Jun 2014 12:40:37 -0400
Subject: [PATCH 17/23] Prune unused variables
These were actually using API that went away in #2352, but they're also
unused in the simplate anyway.
---
www/%username/account/close.spt | 3 ---
1 file changed, 3 deletions(-)
diff --git a/www/%username/account/close.spt b/www/%username/account/close.spt
index 6ffe9fb6be..3c97bcfacd 100644
--- a/www/%username/account/close.spt
+++ b/www/%username/account/close.spt
@@ -6,9 +6,6 @@ title = participant.username # used in the title tag
username = participant.username # used in footer shared with on/$platform/
# pages
-can_upstream = participant.get_dollars_receiving() > 0
-can_downstream = participant.get_dollars_giving() > 0
-
if POST:
disbursement_strategy = request.body.get('disbursement_strategy')
participant.close(disbursement_strategy)
From a8195015c46879e8a9f6471a9b3df5f249bf4892 Mon Sep 17 00:00:00 2001
From: Chad Whitacre
Date: Wed, 11 Jun 2014 14:26:39 -0400
Subject: [PATCH 18/23] Implement "Account closed" page as 410
---
410.spt | 21 +++++++++++++++++++++
gittip/utils/__init__.py | 3 +++
2 files changed, 24 insertions(+)
create mode 100644 410.spt
diff --git a/410.spt b/410.spt
new file mode 100644
index 0000000000..5707944f41
--- /dev/null
+++ b/410.spt
@@ -0,0 +1,21 @@
+[---]
+[---] text/html via jinja2
+{% extends "templates/base.html" %}
+{% block heading %}
Closed
{% endblock %}
+{% block box %}
+
+
+
+
The account owner has closed this account.
+
+ {% if user.ANON %}
+
Are you the account owner?
+
+
{% include "templates/sign-in-using.html" %} to reopen your account.
+ {% endif %}
+
+
+
+
+
+{% endblock %}
diff --git a/gittip/utils/__init__.py b/gittip/utils/__init__.py
index a8711d9d86..feeb647d3a 100644
--- a/gittip/utils/__init__.py
+++ b/gittip/utils/__init__.py
@@ -352,6 +352,9 @@ def get_participant(request, restrict=True):
canonicalize(request.line.uri.path.raw, '/', participant.username, slug, qs)
+ if participant.is_closed:
+ raise Response(410)
+
if participant.claimed_time is None:
# This is a stub participant record for someone on another platform who
From 1b2ebc1aa71b2b42351d9945df1d43eb279d7fef Mon Sep 17 00:00:00 2001
From: Chad Whitacre
Date: Wed, 11 Jun 2014 14:29:16 -0400
Subject: [PATCH 19/23] Redirect to "Account closed" page after closing
---
www/%username/account/close.spt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/www/%username/account/close.spt b/www/%username/account/close.spt
index 3c97bcfacd..5c097c7d5e 100644
--- a/www/%username/account/close.spt
+++ b/www/%username/account/close.spt
@@ -9,7 +9,7 @@ username = participant.username # used in footer shared with on/$platform/
if POST:
disbursement_strategy = request.body.get('disbursement_strategy')
participant.close(disbursement_strategy)
- request.redirect('/')
+ request.redirect('/%s/' % participant.username)
[---] text/html
{% extends "templates/base.html" %}
@@ -78,7 +78,7 @@ if POST:
received from).
After you close your account, your profile page will say,
- "Account closed by user."
+ “The account owner has closed this account.”
Remember
From 34228d9bbfdb13961b283c1ba1094f2cffba64f8 Mon Sep 17 00:00:00 2001
From: Chad Whitacre
Date: Wed, 11 Jun 2014 14:31:14 -0400
Subject: [PATCH 20/23] Lead with "Personal information" on close page
---
www/%username/account/close.spt | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/www/%username/account/close.spt b/www/%username/account/close.spt
index 5c097c7d5e..6c5b58fa70 100644
--- a/www/%username/account/close.spt
+++ b/www/%username/account/close.spt
@@ -46,17 +46,6 @@ if POST:
{% endif %}
-
Username
-
-
We may give your username to someone else if they ask for
- it, but not for at least a year after you close your account
- (unless we determine that you've been infringing a
- trademark).
-
-
Until we give your username to someone else, you can use it
- again if you ever decide to rejoin Gittip. Simply sign in.
-
-
Personal Information
We immediately clear out most of the information in your
@@ -81,6 +70,17 @@ if POST:
“The account owner has closed this account.”
+
Username
+
+
We may give your username to someone else if they ask for
+ it, but not for at least a year after you close your account
+ (unless we determine that you've been infringing a
+ trademark).
+
+
Until we give your username to someone else, you can use it
+ again if you ever decide to rejoin Gittip. Simply sign in.
+
+
Remember
We have no control over links to your profile from other
From 676646b8da140617838a75f8618dd046c2b161f1 Mon Sep 17 00:00:00 2001
From: Chad Whitacre
Date: Wed, 11 Jun 2014 14:40:44 -0400
Subject: [PATCH 21/23] Fix a couple regressions from merging or sumthin'
---
tests/py/test_close.py | 2 +-
www/%username/account/close.spt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/py/test_close.py b/tests/py/test_close.py
index a830286ccc..731878ce82 100644
--- a/tests/py/test_close.py
+++ b/tests/py/test_close.py
@@ -22,7 +22,7 @@ def test_close_closes(self):
alice.set_tip_to(bob, D('3.00'))
carl.set_tip_to(alice, D('2.00'))
- alice.cancel('downstream')
+ alice.close('downstream')
assert carl.get_tip_to('alice') == 0
assert alice.balance == 0
diff --git a/www/%username/account/close.spt b/www/%username/account/close.spt
index 6c5b58fa70..fedbd702aa 100644
--- a/www/%username/account/close.spt
+++ b/www/%username/account/close.spt
@@ -33,7 +33,7 @@ if POST:
+ value="downstream" {{ 'disabled' if not participant.giving }} />
From 886714fd3293c889993852ccfbb3bfe387fa4a67 Mon Sep 17 00:00:00 2001
From: Chad Whitacre
Date: Thu, 12 Jun 2014 10:13:19 -0400
Subject: [PATCH 22/23] Disallow account closing during payday
---
tests/py/test_close.py | 31 +++++++++++++++++++++++++++++++
www/%username/account/close.spt | 33 ++++++++++++++++++++++++++++-----
2 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/tests/py/test_close.py b/tests/py/test_close.py
index 731878ce82..bf170e33c8 100644
--- a/tests/py/test_close.py
+++ b/tests/py/test_close.py
@@ -5,6 +5,7 @@
import balanced
import pytest
+from gittip.billing.payday import Payday
from gittip.models.community import Community
from gittip.models.participant import Participant
from gittip.testing import Harness
@@ -32,6 +33,36 @@ def test_close_raises_for_unknown_disbursement_strategy(self):
with pytest.raises(alice.UnknownDisbursementStrategy):
alice.close('cheese')
+ def test_close_page_is_usually_available(self):
+ self.make_participant('alice', claimed_time='now')
+ body = self.client.GET('/alice/account/close', auth_as='alice').body
+ assert 'Personal Information' in body
+
+ def test_close_page_is_not_available_during_payday(self):
+ Payday(self.db).start()
+ self.make_participant('alice', claimed_time='now')
+ body = self.client.GET('/alice/account/close', auth_as='alice').body
+ assert 'Personal Information' not in body
+ assert 'Try Again Later' in body
+
+ def test_can_post_to_close_page(self):
+ alice = self.make_participant('alice', claimed_time='now', balance=7)
+ bob = self.make_participant('bob', claimed_time='now')
+ alice.set_tip_to(bob, D('10.00'))
+
+ data = {'disbursement_strategy': 'downstream'}
+ response = self.client.PxST('/alice/account/close', auth_as='alice', data=data)
+ assert response.code == 302
+ assert response.headers['Location'] == '/alice/'
+ assert Participant.from_username('alice').balance == 0
+ assert Participant.from_username('bob').balance == 7
+
+ def test_cant_post_to_close_page_during_payday(self):
+ Payday(self.db).start()
+ self.make_participant('alice', claimed_time='now')
+ body = self.client.POST('/alice/account/close', auth_as='alice').body
+ assert 'Try Again Later' in body
+
# wbtba - withdraw_balance_to_bank_account
diff --git a/www/%username/account/close.spt b/www/%username/account/close.spt
index fedbd702aa..983a1cab87 100644
--- a/www/%username/account/close.spt
+++ b/www/%username/account/close.spt
@@ -6,10 +6,19 @@ title = participant.username # used in the title tag
username = participant.username # used in footer shared with on/$platform/
# pages
+payday_is_running = website.db.one("""
+
+ SELECT ts_start FROM paydays WHERE ts_end='1970-01-01T00:00:00+00'::timestamptz
+
+""") is not None
+
if POST:
- disbursement_strategy = request.body.get('disbursement_strategy')
- participant.close(disbursement_strategy)
- request.redirect('/%s/' % participant.username)
+ if payday_is_running:
+ pass # User will get the "Try Again Later" message.
+ else:
+ disbursement_strategy = request.body.get('disbursement_strategy')
+ participant.close(disbursement_strategy)
+ request.redirect('/%s/' % participant.username)
[---] text/html
{% extends "templates/base.html" %}
@@ -19,11 +28,24 @@ if POST:
{% block box %}
+ {% if payday_is_running %}
+
+
+
+
Try Again Later
+
+
Sorry, we're running payday right now, and we're not set up
+ to close accounts while payday is running. Please check back in
+ a few hours.
+
+
+
+ {% else %}
-
+
{% if participant.balance > 0 %}
-
Balance
+
Balance
You have a balance of ${{ participant.balance }}.
What should we do with it?
@@ -99,5 +121,6 @@ if POST:
type="submit">Yes, Close My Gittip Account
+ {% endif %}
{% endblock %}
From 394e9b8fbfac60c2ef6be0472905cf1747b411df Mon Sep 17 00:00:00 2001
From: Chad Whitacre
Date: Fri, 13 Jun 2014 14:37:28 -0400
Subject: [PATCH 23/23] Add guards to disbursement options
Simple conditionals with instructions in non-available cases. Good
enough for now?
---
gittip/models/participant.py | 8 +++++++
www/%username/account/close.spt | 39 ++++++++++++++++++++++++++++-----
2 files changed, 41 insertions(+), 6 deletions(-)
diff --git a/gittip/models/participant.py b/gittip/models/participant.py
index 075c144ca6..8e4d76015f 100644
--- a/gittip/models/participant.py
+++ b/gittip/models/participant.py
@@ -149,6 +149,14 @@ def set_session_expires(self, expires):
self.set_attributes(session_expires=expires)
+ # Suspiciousness
+ # ==============
+
+ @property
+ def is_whitelisted(self):
+ return self.is_suspicious is False
+
+
# Claimed-ness
# ============
diff --git a/www/%username/account/close.spt b/www/%username/account/close.spt
index 983a1cab87..8fce29ffdb 100644
--- a/www/%username/account/close.spt
+++ b/www/%username/account/close.spt
@@ -50,14 +50,41 @@ if POST:
What should we do with it?
-
-
+
+ {% if participant.last_ach_result == '' %}
+ {% if participant.is_whitelisted %}
+