Skip to content

Commit

Permalink
Merge pull request #2355 from liberapay/various
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco authored May 5, 2024
2 parents 93d62dc + 3d418bd commit 382f971
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 57 deletions.
8 changes: 5 additions & 3 deletions liberapay/models/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -2200,10 +2200,10 @@ def update_avatar(self, src=None, cursor=None, avatar_email=None, check=True):
# Look up the SRV record to use.
email_domain = normalized_email.rsplit('@', 1)[1]
try:
srv_records = DNS.query('_avatars-sec._tcp.'+email_domain, 'SRV')
srv_records = DNS.resolve('_avatars-sec._tcp.'+email_domain, 'SRV')
scheme = 'https'
except Exception:
srv_records = DNS.query('_avatars._tcp.'+email_domain, 'SRV')
srv_records = DNS.resolve('_avatars._tcp.'+email_domain, 'SRV')
scheme = 'http'
# Filter down to just the records with the "highest" `.priority`
# (lower number = higher priority); for the libravatar API tells us:
Expand Down Expand Up @@ -3294,7 +3294,9 @@ def get_tips_awaiting_payment(self, weeks_early=3, exclude_recipients_of=None):
WHERE pt.payer = t.tipper
AND COALESCE(pt.team, pt.recipient) = t.tippee
AND ( pi.status IN ('awaiting_review', 'pending') OR
pt.status IN ('awaiting_review', 'pending') )
pt.status IN ('awaiting_review', 'pending') OR
pi.status = 'succeeded' AND
pi.ctime > (current_timestamp - interval '5 days') )
LIMIT 1
){}
ORDER BY ( SELECT 1
Expand Down
6 changes: 3 additions & 3 deletions liberapay/utils/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def get_email_server_addresses(email):
"""
domain = email.domain
rrset = DNS.query(domain, 'MX', raise_on_no_answer=False).rrset
rrset = DNS.resolve(domain, 'MX', raise_on_no_answer=False).rrset
if rrset:
if len(rrset) == 1 and str(rrset[0].exchange) == '.':
# This domain doesn't accept email. https://tools.ietf.org/html/rfc7505
Expand Down Expand Up @@ -298,11 +298,11 @@ def get_public_ip_addresses(domain):
records = []
exception = None
try:
records.extend(DNS.query(domain, 'A', raise_on_no_answer=False).rrset or ())
records.extend(DNS.resolve(domain, 'A', raise_on_no_answer=False).rrset or ())
except DNSException as e:
exception = e
try:
records.extend(DNS.query(domain, 'AAAA', raise_on_no_answer=False).rrset or ())
records.extend(DNS.resolve(domain, 'AAAA', raise_on_no_answer=False).rrset or ())
except DNSException:
if exception:
raise exception from None
Expand Down
20 changes: 6 additions & 14 deletions requirements_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ pando==0.47 \
filesystem_tree==1.1.2 \
--hash=sha256:8e2c564aec53021da07d2b9ec409fb44e7d4e9d8a6ceda34db03f5d4c7d981f9

first==2.0.1 \
--hash=sha256:3bb3de3582cb27071cfb514f00ed784dc444b7f96dc21e140de65fe00585c95e \
--hash=sha256:41d5b64e70507d0c3ca742d68010a76060eea8a3d863e9b5130ab11a4a91aa0e
first==2.0.2 \
--hash=sha256:8d8e46e115ea8ac652c76123c0865e3ff18372aef6f03c22809ceefcea9dec86 \
--hash=sha256:ff285b08c55f8c97ce4ea7012743af2495c9f1291785f163722bd36f6af6d3bf

setuptools==68.2.2 \
--hash=sha256:4ac1475276d2f1c48684874089fefcd83bd7162ddaafb81fac866ba0db282a87 \
Expand Down Expand Up @@ -498,14 +498,6 @@ misaka==2.1.1 \
--hash=sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6 \
--hash=sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc

statistics==1.0.3.5 \
--hash=sha256:2dc379b80b07bf2ddd5488cad06b2b9531da4dd31edb04dc9ec0dc226486c138

docutils==0.13.1 \
--hash=sha256:718c0f5fb677be0f34b781e04241c4067cbd9327b66bdd8e763201130f5175be \
--hash=sha256:cb3ebcb09242804f84bdbf0b26504077a054da6772c6f4d625f335cc53ebf94d \
--hash=sha256:de454f1015958450b72641165c08afe7023cd7e3944396448f2fb1b0ccba9d77

python-dateutil==2.9.0 \
--hash=sha256:78e73e19c63f5b20ffa567001531680d939dc042bf7850431877645523c66709 \
--hash=sha256:cbf2f1da5e6083ac2fbfd4da39a25f34312230110440f424a14c7558bb85d82e
Expand All @@ -514,9 +506,9 @@ boto3==1.34.93 \
--hash=sha256:b59355bf4a1408563969526f314611dbeacc151cf90ecb22af295dcc4fe18def \
--hash=sha256:e39516e4ca21612932599819662759c04485d53ca457996a913163da11f052a4

botocore==1.34.93 \
--hash=sha256:6fbd5a53a2adc9b3d4ebd90ae0ede83a91a41d96231f8a5984051f75495f246d \
--hash=sha256:79d39b0b87e962991c6dd55e78ce15155099f6fb741be88b1b8a456a702cc150
botocore==1.34.95 \
--hash=sha256:6bd76a2eadb42b91fa3528392e981ad5b4dfdee3968fa5b904278acf6cbf15ff \
--hash=sha256:ead5823e0dd6751ece5498cb979fd9abf190e691c8833bcac6876fd6ca261fa7

jmespath==1.0.1 \
--hash=sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980 \
Expand Down
7 changes: 6 additions & 1 deletion www/%username/giving/index.html.spt
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,17 @@ next_payday = compute_next_payday_date()
</a>
% endif
</p>
% if tip.amount.currency not in tip.tippee_p.accepted_currencies_set
<p class="text-warning">{{ icon('exclamation-sign') }} {{ _(
"The recipient no longer accepts payments in {currency}.",
currency=Currency(tip.amount.currency),
) }}</p>
% endif
% else
% if tip.tippee in has_pending_transfer
<p class="text-warning">{{ icon('info-sign') }} {{
_("Pending payment completion.")
}}</p>
<br>
% elif tip.payment_providers
<p class="text-danger">{{ icon('exclamation-sign') }} {{ _(
"You need to initiate a new payment to fund this donation. "
Expand Down
59 changes: 28 additions & 31 deletions www/%username/giving/pay/%payment_id.spt
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,27 @@ title = _("Funding your donations")

% block thin_content

% if n_payments > 1
% set currency_conflicts = donation_groups['currency_conflict']
% if currency_conflicts
<p class="text-warning">{{ icon('warning-sign') }} &nbsp;{{ ngettext(
"You have {n} donation which needs to be modified because the "
"recipient no longer accepts the currency you had chosen.",
"You have {n} donations which need to be modified because the "
"recipients no longer accept the currencies you had chosen.",
n=len(currency_conflicts)
) }}</p>
<div class="buttons">
% for tip in currency_conflicts
<a class="btn btn-primary btn-block" href="{{ tip.tippee_p.path('donate') }}">{{ _(
"Modify your donation to {username}",
username=BOLD % tip.tippee_p.username,
) }}</a>
% endfor
</div>
<br>
% endif

% set currency_conflicts = donation_groups['currency_conflict']
% if n_payments > 1

% if n_fundable > 1 and not retry_id
<p>{{ ngettext(
Expand All @@ -195,35 +213,14 @@ title = _("Funding your donations")
) }}</p>
% endif

% if currency_conflicts
<p class="text-warning">{{ icon('warning-sign') }} &nbsp;{{ ngettext(
"You have {n} donation which needs to be modified because the "
"recipient no longer accepts the currency you had chosen.",
"You have {n} donations which need to be modified because the "
"recipients no longer accept the currencies you had chosen.",
n=len(currency_conflicts)
) }}</p>
<div class="buttons">
% for tip in currency_conflicts
<a class="btn btn-primary btn-block" href="{{ tip.tippee_p.path('donate') }}">{{ _(
"Modify your donation to {username}",
username=BOLD % tip.tippee_p.username,
) }}</a>
% endfor
</div>
<br>
% endif

% if n_payments > 1
<p class="text-info">{{ icon('info-sign') }} &nbsp;{{ ngettext(
"",
"Due to legal and technical limitations we are currently unable to process "
"all your donations as a single payment. Instead you will have to make {n} "
"separate payments. We apologize for the inconvenience.",
n=n_payments
) }}</p>
<br>
% endif
<p class="text-info">{{ icon('info-sign') }} &nbsp;{{ ngettext(
"",
"Due to legal and technical limitations we are currently unable to process "
"all your donations as a single payment. Instead you will have to make {n} "
"separate payments. We apologize for the inconvenience.",
n=n_payments
) }}</p>
<br>

<div class="buttons">
% for payment in payments
Expand Down
7 changes: 3 additions & 4 deletions www/admin/admins.spt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from pando import json

PAGE_SIZE = 20

[---]

user.require_active_privilege('admin')

page_size = request.qs.get_int('page_size', 50, minimum=1, maximum=500)
events = website.db.all("""
SELECT e.*, p.username, admin.username AS recorder_name
FROM events e
Expand All @@ -15,7 +14,7 @@ events = website.db.all("""
AND coalesce(e.ts < %s, true)
ORDER BY e.ts DESC
LIMIT %s
""", (request.qs.get('before'), PAGE_SIZE))
""", (request.qs.get('before'), page_size))

title = "Admins Oversight"

Expand Down Expand Up @@ -45,7 +44,7 @@ title = "Admins Oversight"
% endif
% endif
% endfor
% if len(events) == PAGE_SIZE
% if len(events) == page_size
<a class="btn btn-primary" href="{{ request.qs.derive(before=events[-1].ts.isoformat()) }}">Next page →</a>
% endif
% else
Expand Down
2 changes: 1 addition & 1 deletion www/admin/users.spt
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ elif mode == 'new_recipients':
) ORDER BY pt.row_number) AS incoming_payments
, ( SELECT f.feedback FROM feedback f WHERE f.participant = p.id ) AS feedback
FROM ( SELECT pt.*
, row_number() OVER (PARTITION BY pt.recipient ORDER BY pt.ctime DESC, pt.id DESC)
, row_number() OVER (PARTITION BY pt.recipient ORDER BY pt.ctime ASC, pt.id ASC)
FROM payin_transfers pt
WHERE pt.status <> 'pre'
AND coalesce(pt.error <> 'aborted by payer', true)
Expand Down

0 comments on commit 382f971

Please sign in to comment.