def forward_entity(entity, target_content_id):
"""Handle forwarding of an entity related to a target content.
For example: remote replies on local content, remote shares on local content.
Currently only for public content.
"""
try:
target_content = Content.objects.get(id=target_content_id, visibility=Visibility.PUBLIC, local=True)
except Content.DoesNotExist:
logger.warning("forward_entity - No public local content found with id %s", target_content_id)
return
try:
content = Content.objects.get(guid=entity.guid, visibility=Visibility.PUBLIC)
except Content.DoesNotExist:
logger.warning("forward_entity - No content found with guid %s", entity.guid)
return
if settings.DEBUG:
# Don't send in development mode
return
recipients = _get_remote_participants_for_content(target_content, exclude=entity.handle)
recipients.extend(_get_remote_followers(target_content.author, exclude=entity.handle))
handle_send(entity, content.author, recipients, parent_user=target_content.author)
评论列表
文章目录