Esempio n. 1
0
def star(user, comment, ip='0.0.0.0'):
    if not comment.parent_comment_id:
        raise ServiceError("Can't star a quest.")

    comment.sticker(user, settings.STAR_STICKER_TYPE_ID, skip_self_check=True, ip=ip)

    if not has_starred(comment, user) and user.id != comment.author_id:
        economy.credit_star(comment.author)
Esempio n. 2
0
def star(user, comment, ip='0.0.0.0'):
    if not comment.parent_comment_id:
        raise ServiceError("Can't star a quest.")

    comment.sticker(user,
                    settings.STAR_STICKER_TYPE_ID,
                    skip_self_check=True,
                    ip=ip)

    if not has_starred(comment, user) and user.id != comment.author_id:
        economy.credit_star(comment.author)
Esempio n. 3
0
def star(user, comment, ip='0.0.0.0', request=None):
    if not comment.parent_comment_id:
        raise ServiceError("Can't star a quest.")

    try:
        comment.sticker(user, settings.STAR_STICKER_TYPE_ID, skip_self_check=True, ip=ip)
    except ServiceError:
        if request:
            Metrics.star_error.record(request)
        return

    comment.refresh_star_count()

    if not has_starred(user, comment) and user.id != comment.author_id:
        economy.credit_star(comment.author)