Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

implement account cancellation #2412

Merged
merged 25 commits into from
Jun 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
72dde08
Rough in UI for account cancelation; #54
chadwhitacre May 16, 2014
bc126da
Rough in UI for case where there is no balance
chadwhitacre Jun 6, 2014
9341ae0
Fill out verbiage on cancel page
chadwhitacre Jun 6, 2014
27568e0
Note more things we need to delete during cancel
chadwhitacre Jun 6, 2014
a6d7748
Change nomenclature from "cancel" to "close"
chadwhitacre Jun 6, 2014
14a64be
Add border to red button to make it a button
chadwhitacre Jun 6, 2014
1df3b54
Drop js confirm for account close
chadwhitacre Jun 6, 2014
e2e67e7
Clarify wording around what's deleted on close
chadwhitacre Jun 6, 2014
826f9ae
Here's the test fixture for cancel -> close
chadwhitacre Jun 6, 2014
7f04c97
Prune vestigial disbursement strategy
chadwhitacre Jun 6, 2014
a4fe44a
remove vestigial file
Changaco Jun 7, 2014
b482f9b
update FAQ
Changaco Jun 7, 2014
b8385a2
show a message instead of redirecting to homepage
Changaco Jun 7, 2014
376f939
Tweak language on close page
chadwhitacre Jun 10, 2014
ce89b1f
Dial back language on Close to be more accurate
chadwhitacre Jun 10, 2014
8541ed2
Tweak language on close page
chadwhitacre Jun 11, 2014
607af9b
Prune unused variables
chadwhitacre Jun 11, 2014
c8e328c
Merge branch 'master' into cancel-account
chadwhitacre Jun 11, 2014
a819501
Implement "Account closed" page as 410
chadwhitacre Jun 11, 2014
1b2ebc1
Redirect to "Account closed" page after closing
chadwhitacre Jun 11, 2014
34228d9
Lead with "Personal information" on close page
chadwhitacre Jun 11, 2014
7cf1f90
Merge branch 'master' into cancel-account
chadwhitacre Jun 11, 2014
676646b
Fix a couple regressions from merging or sumthin'
chadwhitacre Jun 11, 2014
886714f
Disallow account closing during payday
chadwhitacre Jun 12, 2014
394e9b8
Add guards to disbursement options
chadwhitacre Jun 13, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions 410.spt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[---]
[---] text/html via jinja2
{% extends "templates/base.html" %}
{% block heading %}<h2 class="top"><span>Closed</span></h2>{% endblock %}
{% block box %}

<div class="as-content">

<p style="margin: 3em 0;">The account owner has closed this account.</p>

{% if user.ANON %}
<h2>Are you the account owner?</h2>

<p>{% include "templates/sign-in-using.html" %} to reopen your account.</p>
{% endif %}

</div>

<div class="nav level-1"><a href="/"><button>Home</button></a></div>

{% endblock %}
84 changes: 0 additions & 84 deletions bin/deactivate.py

This file was deleted.

41 changes: 0 additions & 41 deletions bin/final-gift.py

This file was deleted.

19 changes: 0 additions & 19 deletions bin/untip.py

This file was deleted.

23 changes: 12 additions & 11 deletions gittip/models/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ============

Expand Down Expand Up @@ -236,22 +244,19 @@ def set_as_claimed(self):
self.set_attributes(claimed_time=claimed_time)


# Canceling
# =========
# Closing
# =======

class UnknownDisbursementStrategy(Exception): pass

def cancel(self, disbursement_strategy):
"""Cancel the participant's account.
def close(self, disbursement_strategy):
"""Close the participant's account.
"""
with self.db.get_cursor() as cursor:

if disbursement_strategy == None:
pass # No balance, supposedly. final_check will make sure.
elif disbursement_strategy == 'bank':
self.withdraw_balance_to_bank_account(cursor)
elif disbursement_strategy == 'upstream':
self.refund_to_patrons(cursor)
elif disbursement_strategy == 'downstream':
# This in particular needs to come before clear_tips_giving.
self.distribute_balance_as_final_gift(cursor)
Expand Down Expand Up @@ -290,10 +295,6 @@ def withdraw_balance_to_bank_account(self, cursor):
) # XXX Records the exchange using a different cursor. :-/


def refund_balance_to_patrons(self, cursor):
raise NotImplementedError


class NoOneToGiveFinalGiftTo(Exception): pass

def distribute_balance_as_final_gift(self, cursor):
Expand Down
3 changes: 3 additions & 0 deletions gittip/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions js/gittip/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,11 @@ Gittip.account.init = function() {
return false;
});


// Wire up close knob.
// ===================

$('button.close-account').click(function() {
window.location.href = './close';
});
};
5 changes: 3 additions & 2 deletions scss/buttons-knobs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ button.selected:hover, button.selected.drag,
}

button.join-leave[data-is-member="true"],
.button.join-leave[data-is-member="true"] {
.button.join-leave[data-is-member="true"],
button.close-account {
font-weight: normal;
background: none;
color: $red;
text-decoration: underline;
border: 1px solid $red;
&:hover {
background: $red;
color: white;
Expand Down
12 changes: 11 additions & 1 deletion scss/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,14 @@
padding: 0;
text-transform: uppercase;
}
input {
input[type="radio"] + label {
display: inline;
margin: 0;
}
input[type="radio"]:disabled + label {
color: #888;
}
input:not([type]), input[type="text"] {
font: normal 11pt/14pt $Helvetica;
width: 292px;
margin: 0;
Expand All @@ -431,6 +438,9 @@
input.disabled {
color: $light-brown;
}
input[type="radio"] {
vertical-align: middle;
}

.half input {
width: 137px;
Expand Down
Loading