Exemplo n.º 1
1
    def test_actor_avatar(self):
        avatar = create_content()
        self.api_post('/api/user/change_avatar', {'content_id': avatar.id}, user=self.actor)

        comment = create_quest_comment(author=self.user)
        star_models.star(self.actor, comment)

        sticker = comment.stickers.all()[0]
        stream = ActivityStream(self.user.id, activity_types={StarredActivity.TYPE: StarredActivity})
        activity = StarredActivity.from_sticker(self.actor, sticker)
        stream.push(activity)

        activity, _ = list(self.user.redis.activity_stream)
        self.assertTrue('avatar_url' in activity.to_client()['actor'])
Exemplo n.º 2
0
    def _star(self, api=False, user=None):
        if user is None:
            user = self.user

        if api:
            self.api_post('/api/stars/star', {'comment_id': self.comment.id}, user=user)
        else:
            models.star(user, self.comment)
Exemplo n.º 3
0
    def test_reactions(self):
        cmt = create_quest_comment()

        star_models.star(create_user(), cmt)
        Playback.append(comment=cmt, viewer=create_user())

        cmt = QuestComment.objects.get(id=cmt.id)
        reactions = cmt.details().reactions
        self.assertEqual(len(reactions), 2)
Exemplo n.º 4
0
    def test_reactions(self):
        cmt = create_quest_comment()

        star_models.star(create_user(), cmt)
        Playback.append(comment=cmt, viewer=create_user())

        cmt = QuestComment.objects.get(id=cmt.id)
        reactions = cmt.details().reactions
        self.assertEqual(len(reactions), 2)
Exemplo n.º 5
0
    def _star(self, api=False, user=None):
        if user is None:
            user = self.user

        if api:
            self.api_post('/api/stars/star', {'comment_id': self.comment.id},
                          user=user)
        else:
            models.star(user, self.comment)
Exemplo n.º 6
0
def star_comment(request, comment_id):
    comment = get_object_or_404(QuestComment, id=comment_id)

    check_star_rate_limit(request, comment)

    models.star(request.user, comment, ip=request.META['REMOTE_ADDR'])
    Metrics.star.record(request, comment=comment.id)

    comment_details = comment.details()

    return {'comment': comment.details()}
Exemplo n.º 7
0
def star_comment(request, comment_id):
    comment = get_object_or_404(QuestComment, id=comment_id)

    check_star_rate_limit(request, comment)

    models.star(request.user, comment, ip=request.META['REMOTE_ADDR'])
    Metrics.star.record(request, comment=comment.id)

    comment_details = comment.details()

    return {'comment': comment.details()}
Exemplo n.º 8
0
def star_comment(request, comment_id):
    comment = get_object_or_404(QuestComment, id=comment_id)

    check_star_rate_limit(request, comment)

    models.star(request.user, comment, ip=request.META['REMOTE_ADDR'], request=request)
    Metrics.star.record(request, comment=comment.id)

    comment_details = comment.details()
    add_viewer_has_starred_field([comment_details], viewer=request.user)

    return {'comment': comment_details}
Exemplo n.º 9
0
def star_comment(request, comment_id):
    comment = get_object_or_404(QuestComment, id=comment_id)

    check_star_rate_limit(request, comment)

    models.star(request.user,
                comment,
                ip=request.META['REMOTE_ADDR'],
                request=request)
    Metrics.star.record(request, comment=comment.id)

    comment_details = comment.details()
    add_viewer_has_starred_field([comment_details], viewer=request.user)

    return {'comment': comment_details}
    def test_actor_avatar(self):
        avatar = create_content()
        self.api_post('/api/user/change_avatar', {'content_id': avatar.id},
                      user=self.actor)

        comment = create_quest_comment(author=self.user)
        star_models.star(self.actor, comment)

        sticker = comment.stickers.all()[0]
        stream = ActivityStream(self.user.id, activity_types=[StarredActivity])
        activity = StarredActivity.from_sticker(self.actor, sticker)
        stream.push(activity)

        activity, _ = list(self.user.redis.activity_stream)
        self.assertTrue('avatar_url' in activity.to_client()['actor'])
Exemplo n.º 11
0
 def star(self, user):
     from drawquest.apps.stars.models import star
     return star(user, self)
Exemplo n.º 12
0
 def star(self, user):
     from drawquest.apps.stars.models import star
     return star(user, self)