def send_content(content_id):
"""Handle sending a Content object out via the federation layer.
Currently we only deliver public content.
"""
try:
content = Content.objects.get(id=content_id, visibility=Visibility.PUBLIC, content_type=ContentType.CONTENT,
local=True)
except Content.DoesNotExist:
logger.warning("No local content found with id %s", content_id)
return
entity = make_federable_content(content)
if entity:
if settings.DEBUG:
# Don't send in development mode
return
recipients = [
(settings.SOCIALHOME_RELAY_DOMAIN, "diaspora"),
]
recipients.extend(_get_remote_followers(content.author))
handle_send(entity, content.author, recipients)
else:
logger.warning("send_content - No entity for %s", content)
评论列表
文章目录