fixes integration
This commit is contained in:
@@ -156,13 +156,22 @@ def wordpress_status_webhook(request):
|
||||
content.status = igny8_status
|
||||
logger.info(f"[wordpress_status_webhook] Status updated: {old_status} → {content.status}")
|
||||
|
||||
# Update site_status based on WordPress status
|
||||
old_site_status = content.site_status
|
||||
if post_status == 'publish':
|
||||
content.site_status = 'published'
|
||||
content.site_status_updated_at = timezone.now()
|
||||
elif post_status in ['draft', 'pending', 'trash']:
|
||||
content.site_status = 'not_published'
|
||||
content.site_status_updated_at = timezone.now()
|
||||
|
||||
# Update WordPress status in metadata
|
||||
if not content.metadata:
|
||||
content.metadata = {}
|
||||
content.metadata['wordpress_status'] = post_status
|
||||
content.metadata['last_wp_sync'] = timezone.now().isoformat()
|
||||
|
||||
content.save(update_fields=['external_id', 'external_url', 'status', 'metadata', 'updated_at'])
|
||||
content.save(update_fields=['external_id', 'external_url', 'status', 'site_status', 'site_status_updated_at', 'metadata', 'updated_at'])
|
||||
|
||||
logger.info(f"[wordpress_status_webhook] Updated content {content_id}:")
|
||||
logger.info(f" - Status: {old_status} → {content.status}")
|
||||
|
||||
Reference in New Issue
Block a user