24 lines
618 B
Python
24 lines
618 B
Python
from app.schemas import ActionResult
|
|
|
|
|
|
def can_post_private_note(action_result: ActionResult) -> bool:
|
|
"""
|
|
Política de segurança para escrever notas privadas no Chatwoot.
|
|
|
|
Só permite publicar notas para ações realmente operacionais.
|
|
Bloqueia spam, revisão manual e ações sem necessidade operacional.
|
|
"""
|
|
if not action_result.safe_to_post:
|
|
return False
|
|
|
|
if not action_result.action_required:
|
|
return False
|
|
|
|
if action_result.route in {"spam", "rever"}:
|
|
return False
|
|
|
|
if not str(action_result.action or "").strip():
|
|
return False
|
|
|
|
return True
|