def handle(self, *args, **options):
     for user in User.objects.all():
         post_ids = user.redis.feed_source[:]
         for post_id in post_ids:
             comment_details = CommentDetails.from_id(post_id)
             if not visible_in_feed({'comment': comment_details, 'type': 'post'}):
                 user.redis.feed_source.remove(post_id)
Exemplo n.º 2
0
 def handle(self, *args, **options):
     for user in User.objects.all():
         post_ids = user.redis.feed_source[:]
         for post_id in post_ids:
             comment_details = CommentDetails.from_id(post_id)
             if not visible_in_feed({
                     'comment': comment_details,
                     'type': 'post'
             }):
                 user.redis.feed_source.remove(post_id)
Exemplo n.º 3
0
def publish_new_comment(new_comment):
    from canvas.models import UserRedis

    if not visible_in_feed({'comment': new_comment.details(), 'type': 'comment'}):
        return

    author = new_comment.author

    # Bump unseen counts.
    for user_id in author.redis.new_followers.zrange(0, -1):
        user_redis = UserRedis(user_id)
        user_redis.user_kv.hincrby('feed_unseen', 1)

    updates_channel(author).publish({'comment': new_comment.id, 'type': 'comment'})