Files
devplacepy/devplacepy/schemas/profile.py
T
retoor 8e9d3fad98 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.
2026-08-09 00:18:20 +02:00

103 lines
3.3 KiB
Python

# retoor <retoor@molodetz.nl>
from __future__ import annotations
from typing import Any, Optional
from devplacepy.schemas.base import _Out
from devplacepy.schemas.content import BadgeOut, ProjectOut, UserOut
from devplacepy.schemas.awards import AwardOut
from devplacepy.schemas.listings import FeedItemOut, GistItemOut
class MediaItemOut(_Out):
uid: str = ""
original_filename: Optional[str] = None
file_size: Optional[int] = None
mime_type: Optional[str] = None
url: Optional[str] = None
thumbnail_url: Optional[str] = None
has_thumbnail: bool = False
is_image: bool = False
is_video: bool = False
target_type: Optional[str] = None
target_uid: Optional[str] = None
target_url: Optional[str] = None
created_at: Optional[str] = None
class ProfileOut(_Out):
profile_user: UserOut
posts: list[FeedItemOut] = []
badges: list[BadgeOut] = []
achievements: list[dict] = []
badge_total: int = 0
badge_earned: int = 0
projects: list[ProjectOut] = []
gists: list[GistItemOut] = []
current_tab: Optional[str] = None
posts_count: Optional[int] = None
is_following: bool = False
is_blocked: bool = False
is_muted: bool = False
is_owner: bool = False
profile_online: bool = False
can_view_api_key: bool = False
api_key: Optional[str] = None
ai_correction_enabled: bool = False
ai_correction_sync: bool = False
ai_correction_prompt: Optional[str] = None
ai_modifier_enabled: bool = False
ai_modifier_sync: bool = False
ai_modifier_prompt: Optional[str] = None
interactions_enabled: bool = True
interactions_source: Optional[str] = None
interactions_default: bool = True
interactions_override: Optional[bool] = None
telegram_paired: bool = False
notif_telegram_paired: bool = False
can_manage_customization: bool = False
cust_disable_global: bool = False
cust_disable_pagetype: bool = False
ai_quota: Optional[dict] = None
correction_usage: Optional[dict] = None
modifier_usage: Optional[dict] = None
activities: list[Any] = []
rank: Optional[int] = None
heatmap: Optional[Any] = None
heatmap_months: Optional[Any] = None
streak: Optional[Any] = None
people: list[Any] = []
follow_pagination: Optional[Any] = None
followers_count: Optional[int] = None
following_count: Optional[int] = None
viewer_is_admin: bool = False
xp_next_level: int = 0
xp_progress_pct: int = 0
media: list[MediaItemOut] = []
media_pagination: Optional[Any] = None
notification_prefs: list[Any] = []
awards: list[AwardOut] = []
awards_pagination: Optional[Any] = None
awards_count: int = 0
prominent_award: Optional[AwardOut] = None
can_give_award: bool = False
consents: list[Any] = []
mature_opt_in: bool = False
age_band: Optional[str] = None
terms_version: Optional[str] = None
terms_accepted_at: Optional[str] = None
current_terms_version: Optional[str] = None
suspended_until: Optional[str] = None
suspension_reason: Optional[str] = None
deletion_grace_hours: Optional[int] = None
class TelegramPairOut(_Out):
ok: bool = True
paired: bool = False
code: Optional[str] = None
expires_at: Optional[str] = None
ttl_minutes: Optional[int] = None