fix: let an author list a page they just checked
This commit is contained in:
parent
92813ccbe3
commit
a4178e6d7e
3 changed files with 24 additions and 2 deletions
|
|
@ -223,9 +223,12 @@ def rate_limited(
|
|||
if rejects >= DOMAIN_REJECTS_BEFORE_SLOWDOWN
|
||||
else DOMAIN_COOLDOWN_MINUTES / 60
|
||||
)
|
||||
# Only a real attempt at listing counts. Checking a page is the sensible
|
||||
# thing to do first, and it must not lock the author out of listing it.
|
||||
if _count(
|
||||
connection,
|
||||
"SELECT COUNT(*) FROM submissions WHERE domain = ? AND created_at > ?",
|
||||
"SELECT COUNT(*) FROM submissions WHERE domain = ? AND created_at > ? "
|
||||
"AND outcome IN ('listed', 'updated', 'rejected')",
|
||||
domain,
|
||||
_since(cooldown),
|
||||
):
|
||||
|
|
|
|||
|
|
@ -106,7 +106,10 @@ def report(findings_report, *, listed: bool, command: str) -> str:
|
|||
)
|
||||
elif conforms:
|
||||
title = "This page conforms"
|
||||
opening = "That page follows Mews Profile 0.1. There is nothing to fix."
|
||||
opening = (
|
||||
"That page follows Mews Profile 0.1. Nothing was stored, and the "
|
||||
"site is not in the directory: use Check and list for that."
|
||||
)
|
||||
else:
|
||||
title = "This page doesn't conform yet"
|
||||
opening = (
|
||||
|
|
|
|||
|
|
@ -188,6 +188,22 @@ def test_rate_limits_stop_a_flood(connection):
|
|||
)
|
||||
|
||||
|
||||
def test_checking_a_page_does_not_block_listing_it(connection):
|
||||
"""Checking first is the sensible move; it must not cost the listing."""
|
||||
client = db.ip_hash(connection, "203.0.113.9")
|
||||
db.record_submission(
|
||||
connection,
|
||||
url="https://a.example/",
|
||||
domain="a.example",
|
||||
client=client,
|
||||
outcome="checked",
|
||||
)
|
||||
assert (
|
||||
db.rate_limited(connection, client=client, domain="a.example", listing=True)
|
||||
is None
|
||||
)
|
||||
|
||||
|
||||
def test_a_domain_has_to_wait_between_submissions(connection):
|
||||
client = db.ip_hash(connection, "203.0.113.9")
|
||||
db.record_submission(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue