Skip to content

Commit

Permalink
Merge pull request #2502 from liberapay/various
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco authored Nov 19, 2024
2 parents 65632b1 + df3d334 commit 8287a41
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 45 deletions.
2 changes: 1 addition & 1 deletion liberapay/models/exchange_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def attach_stripe_source(cls, participant, source, one_off):
route.stripe_source = source
return route

def invalidate(self, obj=None):
def invalidate(self):
if self.network.startswith('stripe-'):
if self.address.startswith('pm_'):
try:
Expand Down
8 changes: 6 additions & 2 deletions liberapay/payin/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,16 @@ def update_payin(
""", (payin_id, status, error))

if status in ('pending', 'succeeded'):
cursor.run("""
route = cursor.one("""
UPDATE exchange_routes
SET status = 'consumed'
WHERE id = %s
AND one_off IS TRUE
AND one_off
AND status = 'chargeable'
RETURNING exchange_routes
""", (payin.route,))
if route:
route.invalidate()

# Lock to avoid concurrent updates
cursor.run("SELECT * FROM participants WHERE id = %s FOR UPDATE",
Expand Down
6 changes: 3 additions & 3 deletions style/base/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,6 @@ table.team {
border-left: 2px solid #ddd;
}
}
tr:nth-child(2) > th:nth-child(4), td:nth-child(4) {
border-left: 1px dashed #ddd;
}
td:first-child {
min-width: 12em;
}
Expand All @@ -701,6 +698,9 @@ table.team {
min-width: 8em;
max-width: 11em;
}
tr:last-child td {
border-top-width: 2px;
}
input {
text-align: inherit;
}
Expand Down
31 changes: 13 additions & 18 deletions templates/macros/team-members.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,33 @@
% endif
<table class="table valign-middle team {{ cls }}">
<thead>
<tr>
<th></th>
<th>{{ _("Last Payday") }}<br><small>({{ locale.format_date(last_payday) if last_payday else _("n/a") }})</small></th>
<th colspan=2>{{ _("Next Payday") }}<br><small>({{ locale.format_date(next_payday) }})</small></th>
<th></th>
</tr>
<tr>
<th>{{ _("Member") }}</th>
<th>{{ _("Nominal Take") }}</th>
<th>{{ _("Nominal Take") }}</th>
<th>{{ _("Actual Take") }}</th>
<th><span class="help-title" data-toggle="tooltip" data-placement="top" title="{{ _(
'On Liberapay, donations are paid in advance. This column '
'shows how much money each member has received in advance '
'through this team. An advance increases every time a member '
'receives a new payment from a donor through the team, and '
'decreases every week during “payday”.'
'decreases every week.'
) }}">{{ _("Advance") }}</span></th>
</tr>
</thead>
<tbody>
% for member in members.values()
<tr>
<td><a href="/{{ member.username }}/">{{ member.username }}</a></td>
<td>{{
_("n/a") if member.last_week is none else
_("auto") if member.last_week.amount == -1 else
locale.format_money(member.last_week)
}}</td>
% set nominal_take = member.nominal_take
% set cell_cls = get_cls(member) if nominal_take != member.last_week else ''
% set title = (
None if member.last_week == nominal_take else
_("Last week: {0}", (
_("no take") if member.last_week is none else
_("auto") if member.last_week.amount == -1 else
member.last_week
))
)
% if member.id == user.id
<td class="{{ cell_cls or 'active' }}">
<form action="/~{{ team.id }}/income/take?back_to={{ urlquote(request.line.uri) }}"
Expand All @@ -78,7 +74,7 @@
% endif
<input class="form-control" name="take" value="{{
locale.format_money(nominal_take, format='amount_only') if nominal_take.amount >= 0 else ''
}}" placeholder="auto" />
}}" placeholder="auto"{% if title %} title="{{ title }}"{% endif %} />
<div class="input-group-btn">
<button class="btn btn-default" title="{{ _('Update my nominal take') }}">{{
icon('check-lg')
Expand All @@ -87,10 +83,10 @@
</div>
</form>
</td>
% elif nominal_take.amount == -1
<td class="{{ 'text-'+cell_cls }}">{{ _("auto") }}</td>
% else
<td class="{{ 'text-'+cell_cls }}">{{ locale.format_money(nominal_take) }}</td>
<td class="{{ 'text-'+cell_cls }}"{% if title %} title="{{ title }}"{% endif %}>{{
_("auto") if nominal_take.amount == -1 else locale.format_money(nominal_take)
}}</td>
% endif
% set fuzzy_take = member.actual_amount.fuzzy_sum(nominal_take.currency)
<td{% if fuzzy_take.fuzzy %} title="{{ locale.format_money_basket(member.actual_amount) }}"{% endif %}>{{
Expand All @@ -107,7 +103,6 @@
'because it is not a legal entity.'
) }}" data-toggle="tooltip" data-placement="bottom">{{ _("Leftover") }}</span></td>
<td></td>
<td></td>
% set fuzzy_leftover = members.leftover.fuzzy_sum(team.main_currency)
<td class="{{ 'info' if members.leftover else '' }}"{% if fuzzy_leftover.fuzzy
%} title="{{ locale.format_money_basket(members.leftover) }}"{% endif %}>{{
Expand Down
18 changes: 5 additions & 13 deletions www/about/faq.spt
Original file line number Diff line number Diff line change
Expand Up @@ -239,24 +239,16 @@ title = _("Frequently Asked Questions")
<dd>{{ _("Probably not, but it depends on the tax rules of your country.") }}</dd>


{{ dt(_("What are wallets?"), 'wallets') }}
{{ dt(_("Is a Liberapay account a wallet?"), 'wallets') }}

<dd>{{ _(
"Liberapay used to hold the funds of donors in wallets, but we no longer do "
"that. Instead the full amount of a donation is immediately transferred to "
"the recipient."
"Not since mid-2018. Money sent by a donor immediately goes to the "
"recipient. Previously, funds were held in the donor's account and "
"disbursed little by little to the recipient every week. That system "
"was definitively abandoned due to its very significant drawbacks."
) }}</dd>


{{ dt(_("What is “payday”?"), 'payday') }}

<p>{{ _(
"Payday is a program ({0}this one{1}) that we run every Wednesday. It "
"executes donations and notifies donors and recipients.",
'<a href="https://github.com/liberapay/liberapay.com/blob/master/liberapay/billing/payday.py">'|safe,
'</a>'|safe
) }}</p>

</dl>
</div>
% endblock
16 changes: 8 additions & 8 deletions www/about/teams.spt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ title = _("Teams")

<p>{{ _(
"You can change your takes from {0}your teams dashboard{1}. It contains "
"tables that show the nominal takes of all members for the next and "
"previous payday, as well as an estimate of the actual amounts of money "
"they'll receive in the next payday.",
"tables that show the nominal takes of all members, as well as an estimate "
"of the actual amounts of money that will be deducted at the end of the "
"current weekly cycle.",
'<a href="/about/me/receiving/#teams">'|safe,
'</a>'|safe
) }}</p>
Expand Down Expand Up @@ -184,7 +184,7 @@ title = _("Teams")
<p>{{ _(
"When “take throttling” is enabled for a team, its members can't raise their "
"takes higher than a maximum computed on the basis of the nominal takes at "
"the time of the previous payday. This mechanism is meant to encourage "
"the end of the previous weekly cycle. This mechanism is meant to encourage "
"inviting new contributors to join the team, by ensuring that they won't "
"take a disproportionate share of the income in their first weeks."
) }}</p>
Expand All @@ -193,16 +193,16 @@ title = _("Teams")
"The limit works like this: you can always increase your take to {amount} if "
"it was below that, you can double your take compared to the previous week, "
"you can raise your take to claim the team's leftover income, and you can "
"bring your take up to the level of the median take in the previous payday. "
"Whichever of these possibilities results in the highest amount is your "
"maximum take for the week.",
"bring your take up to the level of the median take at the end of the "
"previous weekly cycle. Whichever of these possibilities results in the "
"highest amount is your maximum take for the week.",
amount=constants.TAKE_THROTTLING_THRESHOLD[currency]
) }}</p>

<p>{{ _(
"Takes are not limited if the team has only one member, or if the previous "
"week's takes were all zero (which is the case for any new team that has "
"been created after the most recent payday)."
"been created during the current weekly cycle)."
) }}</p>

<p>{{ _(
Expand Down

0 comments on commit 8287a41

Please sign in to comment.