tasks.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:socialhome 作者: jaywink 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号