06/16 Phase 6 (continue)

This commit is contained in:
2026-06-17 17:06:43 -04:00
parent 479afde2fa
commit 68a842d6b6
26 changed files with 1027 additions and 61 deletions
+3 -4
View File
@@ -14,9 +14,7 @@ from app.extensions import db
from app.models.messaging import Conversation, Message
from app.services.contact import contact_density
from app.services.email import send_email
# Bodies with ≥ 3 contact signals get auto-flagged
_FLAG_THRESHOLD = 3
from app.services.settings import get_setting
class MessagingError(ValueError):
@@ -60,7 +58,8 @@ def send_message(conversation, sender, body: str) -> Message:
if sender.id not in (conversation.buyer_id, conversation.seller_id):
raise MessagingError("not a participant")
flagged = contact_density(body) >= _FLAG_THRESHOLD
threshold = get_setting("contact_density_threshold", 3)
flagged = contact_density(body) >= threshold
msg = Message(
conversation_id=conversation.id,