def send_reply(content_id):
"""Handle sending a Content object that is a reply 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.REPLY,
local=True)
except Content.DoesNotExist:
logger.warning("No content found with id %s", content_id)
return
entity = make_federable_content(content)
if not entity:
logger.warning("send_reply - No entity for %s", content)
if settings.DEBUG:
# Don't send in development mode
return
# Send directly (remote parent) or as a relayable (local parent)
if content.parent.local:
forward_entity(entity, content.parent.id)
else:
# We only need to send to the original author
recipients = [
(content.parent.author.handle, None),
]
handle_send(entity, content.author, recipients)
评论列表
文章目录