06/16 Phase 6 (continue)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user