forked from retoor/devplacepy
Add the trust and safety subsystem and the App Store compliance work
Implements the moderation and consent obligations a social platform carries, so the web version and any client that speaks to it enforce the same rules. Moderation core (services/moderation/, database/moderation.py): a reportable target registry, the content filter and its choke points, the report queue with atomic resolution, enforcement actions, consent tracking, maturity gating, and account deletion with a grace window. Surfaces: POST /reports plus the member report list, /admin/moderation and the per-report admin view, /workspaces, terms acceptance at /auth/terms, consent and account deletion under /profile, the report button and dialog partials, the maturity gate, and the moderation stylesheet and ReportDialog client. Every user-generated surface stays reportable by construction: new content tables are registered in REPORTABLE_TARGETS or listed in UNREPORTABLE_TABLES with a reason, and the registry test fails the suite on anything left unclassified. Docs: community guidelines, content moderation, intellectual property, privacy, terms, contact, and the admin-only moderation operations page, plus the moderation API group and the Devii moderation actions. Compliance record: applecomp.md is the requirement register, applechanges.md the gap analysis against this codebase, and appleimpl.md the implementation design they resolve to. Tests cover the report flow, admin moderation, consent, account deletion, terms acceptance, workspaces, and the registry invariant across the unit, api, and e2e tiers.
This commit is contained in:
@@ -24,6 +24,8 @@ def _signup_project_visibility():
|
||||
"email": f"{name}@t.dev",
|
||||
"password": "secret123",
|
||||
"confirm_password": "secret123",
|
||||
"birth_date": "1990-01-01",
|
||||
"accept_terms": "1",
|
||||
},
|
||||
allow_redirects=True,
|
||||
)
|
||||
@@ -114,6 +116,7 @@ def _seed_owner():
|
||||
{
|
||||
"uid": uid,
|
||||
"username": f"seo_{uid[:8]}",
|
||||
"terms_version": "1",
|
||||
"email": f"{uid[:8]}@seo.test",
|
||||
"password_hash": "x",
|
||||
"role": "Member",
|
||||
@@ -264,6 +267,32 @@ def test_sitemap_headers_and_static_entries(app_server):
|
||||
assert f"{BASE_URL}/gists" in r.text
|
||||
|
||||
|
||||
def test_sitemap_lists_the_public_moderation_surfaces(app_server):
|
||||
xml = requests.get(f"{BASE_URL}/sitemap.xml").text
|
||||
assert f"<loc>{BASE_URL}/reports/reasons</loc>" in xml
|
||||
assert f"<loc>{BASE_URL}/workspaces/index</loc>" in xml
|
||||
assert f"{BASE_URL}/reports/mine" not in xml
|
||||
|
||||
|
||||
def test_sitemap_lists_each_legal_document_exactly_once(app_server):
|
||||
from devplacepy.seo import LEGAL_DOC_SLUGS
|
||||
|
||||
xml = requests.get(f"{BASE_URL}/sitemap.xml").text
|
||||
for slug in LEGAL_DOC_SLUGS:
|
||||
loc = f"<loc>{BASE_URL}/docs/{slug}.html</loc>"
|
||||
assert xml.count(loc) == 1, f"{slug} listed {xml.count(loc)} times"
|
||||
|
||||
|
||||
def test_sitemap_never_repeats_a_documentation_url(app_server):
|
||||
import re
|
||||
|
||||
xml = requests.get(f"{BASE_URL}/sitemap.xml").text
|
||||
locs = [loc for loc in re.findall(r"<loc>(.*?)</loc>", xml) if "/docs/" in loc]
|
||||
assert locs, "the sitemap lists no documentation pages"
|
||||
duplicates = sorted({loc for loc in locs if locs.count(loc) > 1})
|
||||
assert duplicates == [], duplicates
|
||||
|
||||
|
||||
def test_sitemap_includes_published_news(app_server):
|
||||
slug, _ = _seed_news_seo()
|
||||
r = requests.get(f"{BASE_URL}/sitemap.xml")
|
||||
|
||||
Reference in New Issue
Block a user