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

Commit

Permalink
Merge pull request #2412 from gittip/cancel-account
Browse files Browse the repository at this point in the history
implement account cancellation
  • Loading branch information
Changaco committed Jun 13, 2014
2 parents efb6276 + 394e9b8 commit 5bd7e33
Show file tree
Hide file tree
Showing 15 changed files with 356 additions and 260 deletions.
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

0 comments on commit 5bd7e33

Please sign in to comment.