예제 #1
0
파일: models.py 프로젝트: StetHD/canvas-2
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)
예제 #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)
예제 #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)