feat: Add recent published section and filter self-interactions
- Add "Publicaciones Recientes" section to dashboard showing published posts - Filter out self-generated interactions in X API (thread auto-replies) - Improve username resolution for X interactions using user expansions - Pass recent_published data to dashboard template Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -95,14 +95,25 @@ def fetch_platform_interactions(platform: str):
|
||||
).first()
|
||||
|
||||
if not existing:
|
||||
# Obtener username (X usa 'username', Meta usa 'from.id')
|
||||
author_username = comment.get("username")
|
||||
if not author_username:
|
||||
from_data = comment.get("from", {})
|
||||
author_username = from_data.get("id", "unknown") if isinstance(from_data, dict) else "unknown"
|
||||
|
||||
# Obtener nombre del autor
|
||||
author_name = None
|
||||
if isinstance(comment.get("from"), dict):
|
||||
author_name = comment.get("from", {}).get("name")
|
||||
|
||||
interaction = Interaction(
|
||||
platform=platform,
|
||||
interaction_type="comment",
|
||||
post_id=post.id,
|
||||
external_id=external_id,
|
||||
external_post_id=platform_id,
|
||||
author_username=comment.get("username", comment.get("from", {}).get("id", "unknown")),
|
||||
author_name=comment.get("from", {}).get("name") if isinstance(comment.get("from"), dict) else None,
|
||||
author_username=author_username,
|
||||
author_name=author_name,
|
||||
content=comment.get("text", comment.get("message")),
|
||||
interaction_at=datetime.fromisoformat(
|
||||
comment.get("created_at", comment.get("timestamp", comment.get("created_time", datetime.utcnow().isoformat()))).replace("Z", "+00:00")
|
||||
|
||||
Reference in New Issue
Block a user