Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement teams #33

Merged
merged 41 commits into from
Oct 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7ae04e6
prune sentence about team accounts in `close.spt`
Changaco Sep 22, 2015
4388f27
teams don't give and don't have a balance
Changaco Jun 6, 2015
b48c911
allow being a member of a team without taking any money
Changaco Sep 22, 2015
d6eab25
remove obsolete logic for team takes from payday
Changaco Sep 24, 2015
fb191ea
factorize style
Changaco Sep 23, 2015
b848edb
minor clean up
Changaco Sep 26, 2015
2d87395
move payday script into payday module
Changaco Sep 27, 2015
a593505
remove obsolete `take-over` transfer context
Changaco Sep 27, 2015
e2470c4
reimplement joining/taking from/leaving teams
Changaco Sep 23, 2015
55ca43e
move members table rendering server-side
Changaco Jun 6, 2015
64fabb9
implement team invites
Changaco Sep 25, 2015
b63a414
implement creating a team
Changaco Sep 28, 2015
ff97303
reword description of teams
Changaco Sep 28, 2015
b6b243b
fix `Participant.closed_time` property
Changaco Sep 28, 2015
45daed9
close team when there are no members left
Changaco Sep 28, 2015
15875c1
allow the user who closed a team to reopen it
Changaco Sep 28, 2015
30657ce
stop caching participants' "pledging" amounts
Changaco Sep 28, 2015
055afa2
reimplement team takes
Changaco Sep 26, 2015
c9f1bcf
prune unnecessary index
Changaco Sep 28, 2015
20977a4
prune obsolete column `giving_today`
Changaco Sep 29, 2015
97fee32
tweak docstring
Changaco Sep 28, 2015
8b2589d
fix payday rerun
Changaco Sep 28, 2015
f019506
merge fake_payday into payday
Changaco Sep 28, 2015
235c294
always refetch `taking` and `receiving`
Changaco Sep 29, 2015
9feda34
update the tests
Changaco Sep 29, 2015
1fb78b4
show members list on profile page of teams
Changaco Sep 30, 2015
a31d4d1
fix and clean up some styles
Changaco Sep 30, 2015
06f546a
add missing title and fix a bad i18n
Changaco Sep 30, 2015
ceeecac
allow members of a team to edit its profile
Changaco Oct 1, 2015
3717081
restrict `goal` for teams
Changaco Oct 1, 2015
e4fda5a
fix adding a first profile statement
Changaco Oct 2, 2015
52b2c30
fix list of statement languages
Changaco Oct 2, 2015
38228f3
redirect to profile edit page after team creation
Changaco Oct 2, 2015
ad9712b
fix responsiveness of profile page
Changaco Oct 2, 2015
e7cf453
move team takes table to "Income" page
Changaco Oct 2, 2015
e9aac46
don't allow teams to hide their income
Changaco Oct 2, 2015
0b55a90
style username autocompletion results
Changaco Oct 3, 2015
ef3feb1
add a `payday` target to the Makefile
Changaco Oct 3, 2015
18f3d9f
fix broken link
Changaco Oct 3, 2015
da4bde9
change the algorithm of take throttling
Changaco Oct 4, 2015
027e6aa
switch to postgres 9.4
Changaco Oct 4, 2015
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: python
addons:
postgresql: 9.3
postgresql: 9.4
branches:
only:
- master
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ run_:
py: env
PYTHONPATH=. $(with_local_env) $(env_bin)/python -i liberapay/main.py

payday: env
PYTHONPATH=. $(with_local_env) $(env_bin)/python liberapay/billing/payday.py

test-schema: env
$(with_tests_env) ./recreate-schema.sh test

Expand Down
14 changes: 14 additions & 0 deletions emails/team_invite.spt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{ _("You have been invited to join a team on Liberapay") }}

[---] text/html
<p>{{ _("{0} has invited you to join the {1} team.", inviter, team) }}</p>

<a href="{{ team_url }}" style="{{ button_style }}">{{ _("See the team's profile") }}</a>
<a href="{{ team_url }}membership/accept" style="{{ button_style }}">{{ _("Accept") }}</a>
<a href="{{ team_url }}membership/refuse" style="{{ button_style }}">{{ _("Refuse") }}</a>
[---] text/plain
{{ _("{0} has invited you to join the {1} team.", inviter, team) }}

{{ _("See the team's profile") }}: {{ team_url }}
{{ _("Accept") }}: {{ team_url }}membership/accept
{{ _("Refuse") }}: {{ team_url }}membership/refuse
12 changes: 12 additions & 0 deletions js/10-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ Liberapay.init = function() {

Liberapay.forms.jsSubmit();
Liberapay.forms.communityChooser();

var success_re = /([?&])success=[^&]*/;
if (success_re.test(location.search)) {
history.replaceState(null, null,
location.pathname+
location.search.replace(success_re, '$1').replace(/[\?&]$/, '')+
location.hash
);
}
$('.notification .close').click(function(){ $(this).parent().fadeOut() });

Liberapay.lookup.init();
};

Liberapay.error = function(jqXHR, textStatus, errorThrown) {
Expand Down
43 changes: 43 additions & 0 deletions js/lookup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Liberapay.lookup = {};

Liberapay.lookup.init = function() {
$('form.username-lookup').each(function() {
var $form = $(this);
var $input = $form.find('input[name="username"]');
var $results = $form.find('.lookup-results');
$results.css('width', $input.css('width'));

var lookup_timeout = null;
function lookup() {
if (lookup_timeout) clearTimeout(lookup_timeout);
var query = $(this).val();
if (query.length < 3)
$results.empty();
else {
lookup_timeout = setTimeout(function() {
jQuery.get("/search.json", {scope: 'usernames', q: query}).success(drawLookupResults);
}, 300);
}
}

function drawLookupResults(results) {
var items = [];
var results = results.usernames;
for (var i=0, len=results.length; i<len; i++) {
var result = results[i];
items.push(Liberapay.jsonml(
['li', {"data-id": result.id}, result.username]
));
}
$results.html(items);
}

function selectLookupResult() {
$input.val($(this).html()).focus();
$results.empty();
}

$results.on('click', 'li', selectLookupResult);
$input.keyup(lookup);
});
};
202 changes: 0 additions & 202 deletions js/team.js

This file was deleted.

6 changes: 3 additions & 3 deletions liberapay/billing/exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ def propagate_exchange(cursor, participant, route, error, amount):
def transfer(db, tipper, tippee, amount, context, **kw):
t_id = db.one("""
INSERT INTO transfers
(tipper, tippee, amount, context, status)
VALUES (%s, %s, %s, %s, 'pre')
(tipper, tippee, amount, context, team, status)
VALUES (%s, %s, %s, %s, %s, 'pre')
RETURNING id
""", (tipper, tippee, amount, context))
""", (tipper, tippee, amount, context, kw.get('team')))
get = lambda id, col: db.one("SELECT {0} FROM participants WHERE id = %s".format(col), (id,))
tr = Transfer()
tr.AuthorId = kw.get('tipper_mango_id') or get(tipper, 'mangopay_user_id')
Expand Down
Loading